[Zope] Session to session id to session

Peter Bengtsson peterbe at gmail.com
Wed Oct 20 11:38:19 EDT 2004


I've got an application that sort of looks like this:

def _fooLogin(self, u, p):
    if self.SQLTestLogin(u=u, p=p):
        self.REQUEST.SESSION.set('_loggedin', self.SQLUserFoo(u))
        return 1
    return 0

def mylogin(self, u, p):
    if self._fooLogin(u, p):
        return str(self.REQUEST.SESSION.id)

Then in another context but under the same zope instance, this id that
mylogin() returns will be passed to another method. That other method
should try to get the session object back if not expired. How do I do
that?

I was hoping for something like this::

 def getMyGirlfriends(self, sessionid):
      session = self.GetSessionById(sessionid)
      if session.get('_loggedin'):
          return ...

Does anybody know how to do this? Is it even possible?
Are there better methods to approach this with?

-- 
Peter Bengtsson, http://www.peterbe.com


More information about the Zope mailing list