[Twisted-web] Re: session, quick one

noema mailinglists at shechen.at
Fri Apr 23 13:31:01 MDT 2004

...I should have said that in the first place: I am trying to set the 
lifetime of my session but I am not using nevow. Here is the code I use to 
retrieve the session. It works fine but the session times out every 20min 
or so:

if not request.session:
      cookiename = string.join(['TWISTED_SESSION'] \
          + request.sitepath, "_")
      sessionCookie = request.getCookie(cookiename)
      if sessionCookie:
          print 'SESSION RETRIVING'
              request.session = \
          except KeyError:
      # if it still hasn't been set, fix it up.
      if not request.session:
          print 'SESSION NEW'
          request.session = request.site.makeSession()
          request.addCookie(cookiename, request.session.uid, path='/')
          request.session.state = m_web.State(self.glo)

This code seems to be too complicated (too low level) anyways. I was 
hoping for something simple like: 


More information about the Twisted-web mailing list