What's the right way to pass initialization parameters to a SocketServer handler instance? I'm currently setting attributes in the server instance and reading them in the handler method via self.server.<attribute>. It works but it seems a bit obtuse: class PortForwarder(SocketServer.BaseRequestHandler): def handle(self): sys.stdout.write("connection from %s\n" % str(self.client_address)) self.forward = socket.socket(socket.AF_INET,socket.SOCK_STREAM) self.forward.connect(self.server.forwardAddr) [...] serv = SocketServer.TCPServer(("",4567),PortForwarder) serv.forwardAddr = ("localhost",25) serv.serve_forever() -- Grant Edwards grante Yow! Now I am depressed... at visi.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4