""" Gregory Trubetskoy, May 1998 This is a server-specific module, and isn't meant to be used directly. Any server-specific behaviour can be implemented in this module. Here we redefine the RequestHandler.Send() function. This is done by replacing it in the httpdapi module. This works because once the httpdapi module is "imported" in here and modified, every subsequesnt import will use the already imported version with our modification in it. This is why you shouldn't use "reload" with httpdapi because the module-specific stuff will dissapear. I guess this is neither inheitance nor polimorphism - but something cool you can do in Python (parameterized types?). """ import httpdapi def Send( self, content ): # Apache doesn't want us to send content when using # redirects, it puts up a default page. if not self.redirect: self.rq.start_response( self.sn ) self.sn.net_write( str( content ) ) def init( logname=None, rootpkg=None ): # make a custom Send() httpdapi.RequestHandler.Send = Send httpdapi.init( logname=logname, rootpkg=rootpkg )