[albatross-users] A problem with cookies and multiple apps in the same directory

Gregory Bond gnb at itga.com.au
Thu Nov 14 17:16:27 EST 2002


We have 2 .py files in the same (subdir of the) cgi-bin directory, implementing
2 apps using SessionFile mixins.  They have separate secrets and appid's in 
the Application objects.

But we can't use both apps.  If we go to one, then it sets a cookie with the 
name of that appid, and a path of "/cgi-bin/dir".  When we then navigate to 
the second app, it doesn't attempt to set a new cookie, but tries to use the 
cookie set by the previous app, and dies with an exception:

Template traceback (most recent call last):

Traceback (most recent call last):
  File "/usr/local/lib/python2.1/site-packages/albatross/app.py", line 142, in run
    self.load_session(ctx)
  File "/usr/local/lib/python2.1/site-packages/albatross/app.py", line 204, in load_session
    ctx.load_session()
  File "/usr/local/lib/python2.1/site-packages/albatross/sessionfile.py", line 46, in load_session
    sesid = self._get_sesid_from_cookie()
  File "/usr/local/lib/python2.1/site-packages/albatross/sessionfile.py", line 37, in _get_sesid_from_cookie
    return os.path.basename(c[self.app.ses_appid()].value)
  File "/usr/local/lib/python2.1/UserDict.py", line 14, in __getitem__
    def __getitem__(self, key): return self.data[key]
KeyError: unusualwto

(unusualwto is the appid of the second app in this case).  This doesn't seem to
matter which app we chose first, the first one works, the second one dies.

Are we doing something wierd here?





More information about the Albatross-users mailing list