SAiello at Jentoo.com
SAiello at Jentoo.com
Fri Jan 28 12:15:10 EST 2005
Hello, I was wondering if it is possible to run a process when a session timeout expires. I wouldn't believe there is, for there would need to be some process constantly monitoring all the processes for expiration, and immediately run the program. But I figured I would ask. So to try to do this, I figured I would write another process that would monitor that session database. Basically, open and read the '/tmp/mp_session.dbm' run through all the sessions, and if expired run the program I would like to run. The default db for mp_sess.dbm is dbhash. I have never worked with dbhash before, I have worked with gdbm. I tried looking at what is contained within the dbhash file, and I wasn't too sure how to parse the information under the sid keys. So I thought I would see how a mp_sess.dbm file would be created if I specified using gdbm, I used the following lines: import gdbm sess=Session.DbmSession(req, None, None, gdbm) But I get the following error: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch result = object(req) File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line 136, in handler result = util.apply_fs_data(object, req.form, req=req) File "/usr/lib/python2.3/site-packages/mod_python/util.py", line 361, in apply_fs_data return object(**args) File "/var/www/localhost/htdocs/python/inet.py", line 11, in login webtools.login(req, Secret, args) File "/var/www/localhost/htdocs/python/webtools.py", line 23, in login sess=Session.DbmSession(req, None, Secret, gdbm) File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line 294, in __init__ timeout=timeout, lock=lock) File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line 132, in __init__ Cookie.add_cookie(self._req, self.make_cookie()) File "/usr/lib/python2.3/site-packages/mod_python/Cookie.py", line 353, in add_cookie req.headers_out.add("Set-Cookie", str(cookie)) File "/usr/lib/python2.3/site-packages/mod_python/Cookie.py", line 204, in __str__ result = ["%s=%s%s" % (self.name, self.hexdigest(self.value), File "/usr/lib/python2.3/site-packages/mod_python/Cookie.py", line 198, in hexdigest _hmac = hmac.new(self.__data__["secret"], self.name) File "/usr/lib/python2.3/hmac.py", line 97, in new return HMAC(key, msg, digestmod) File "/usr/lib/python2.3/hmac.py", line 41, in __init__ if len(key) > blocksize: TypeError: len() of unsized object Any ideas or suggestions ? Thanks, Steven
|