durusmail: quixote-users: Interface for session persistence
Interface for session persistence
2002-05-18
2002-05-18
2002-05-19
2002-05-20
2002-05-20
2002-05-20
2002-05-20
2002-05-20
2002-05-21
2002-05-24
2002-05-24
2002-05-24
2002-05-18
2002-05-20
2002-05-20
Interface for session persistence
Gene Christian
2002-05-24
> Yes, I'd like to see your patch to Quixote.  Please post it as a unified
> patch ("diff -u" if you have a decent Unix-like diff available.)  Please
> also specify which release your patch is relative to.

My patch is relative to the Quixote-20020521 snapshot release.

Here are the changes to http_request.py:

--- http_request.py Fri May 24 11:41:06 2002
+++ original\http_request.py Mon May 06 08:30:56 2002
@@ -204,15 +204,6 @@
             if path.startswith(script):
                 path = path[len(script):]
                 self.environ['PATH_INFO'] = path
-        # Xitami seems to mangle SCRIPT_NAME:
-        # It leaves PATH_INFO appended to SCRIPT_NAME
-        # This removes the PATH_INFO data from SCRIPT_NAME
-        if (web_server.find('Xitami') != -1):
-            script = environ['SCRIPT_NAME']
-            path = environ['PATH_INFO']
-            if script.endswith(path):
-                script = script[:0-len(path)]
-                self.environ['SCRIPT_NAME'] = script

     def process_inputs (self):
         """Process request inputs.

I created a new file (session_demo_lrwp.py) from session_demo.cgi:

--- session_demo_lrwp.py Fri May 24 11:36:36 2002
+++ original\session_demo.cgi Tue May 21 12:19:46 2002
@@ -20,27 +20,6 @@
 from quixote.session import Session, SessionManager
 from quixote.publish import SessionPublisher

-from lrwp import LRWP
-
-class LRWPSessionPublisher(SessionPublisher):
-    """
-    SessionPublisher configured to use Xitami LRWP.
-    """
-    def publish_lrwp(self):
-        """Run the lrwp publish process"""
-        lrwp = LRWP('test','localhost',81)
-        lrwp.connect()
-
-        while not self.exit_now:
-            r = lrwp.acceptRequest()
-            self.publish(r.inp,r.out,r.err,r.env)
-            r.finish()
-            if self.config.run_once:
-                break
-
-        lrwp.close()
-
-
 class DemoSession (Session):
     """
     Session class that tracks the number of requests made within a
@@ -185,12 +164,10 @@
 # files and ensure that error messages are more informative than secure.

 enable_ptl()
-
 sessions = DirMapping(save_dir="/tmp/quixote-session-demo")
 session_mgr = SessionManager(session_class=DemoSession,
                              session_mapping=sessions)
-
-app = LRWPSessionPublisher('quixote.demo.session', session_mgr=session_mgr)
+app = SessionPublisher('quixote.demo.session', session_mgr=session_mgr)
 app.read_config("demo.conf")
 app.setup_logs()
-app.publish_lrwp()
+app.publish_cgi()

Neither of these has been tested very well (I never did bother to track down
self.exit_now from the cgi publisher, for instance).  I would move the
LRWPSessionPublisher class to a different file, and change the static
options passed to LRWP to config file variables or options passed to the
class contructor.

BTW, thanks for providing the motivation to dig up a win32 diff utility.
I've thought about it a few times, but never done it.  I found one here:
http://www.accurev.com/ftp/free/tkdiff/diff.exe



reply