[mod_python] webinterface for a local telnet server

Robert Sanderson azaroth at liverpool.ac.uk
Fri Oct 6 09:02:22 EDT 2006


>That leads me to the question. What's the best way to write a web app,
>when I need data per user (session) that can not be stored on disk, for
>example a persistent connection to a telnet or IRC server. Unfortunately
>the server does not support sharing connections for multiple clients
>like databases do. It also does not support concurrent connections for
>the same user, so creating one connection per thread is not an option.

I use a ConnectionHandler in order to implement the persistent Z39.50
binary protocol within mod_python.

For example:

Listen *:2100
<VirtualHost *:2100>
   PythonPath "['/home/cheshire/cheshire3/code']+sys.path"
   PythonConnectionHandler zApacheHandler
   PythonDebug On
</VirtualHost>


zApacheHandler:

def connectionhandler(conn):
  handler = HandlerObject(conn)
  handler.read()

...
  def read():
    data = self.connection.read()
    while data:
       # handle data
       data = self.connection.read()

Or have I missed what you're trying to do?

Rob


More information about the Mod_python mailing list