def createGuestSessionAndRedirect(self, sPath): # create new session with the specified guest user oGuest = db.getItem(serverSettings.guest_account) oNewSession = sessionManager.create(oGuest) self.response = response.HTTPResponse() SESSION_ID = oNewSession.sessionid; ROOT = self.request.getRootUrl() PATH = sPath QS = self.request.getQueryString() # add cookie with sessionid self.response.cookies['_sid'] = SESSION_ID self.response.cookies['_sid']['path'] = '/' if '_nojavascript' in QS: self.response.redirect('%(ROOT)s/{%(SESSION_ID)s}%(PATH)s' % locals()) else: oFile = open(COOKIE_DETECT_PAGE) sBody = oFile.read() oFile.close() self.response.write( sBody % locals() ) self.response.end()
def getHandle(): #open database db.open(dbparams.db_class) #create in-memory session manager sessionManager.open(inMemorySessionManager.SessionManager, 1200) oSystemUser = db.getItem('system') currentThread().session = sessionManager.create(oSystemUser) currentThread().trans = None return db
def createGuestSessionAndRedirect(self, sPath): # create new session with the specified guest user oGuest = db.getItem(serverSettings.guest_account) oNewSession = sessionManager.create(oGuest) self.response.redirect( '%s/{%s}%s%s' % ( self.request.getRootUrl() ,oNewSession.sessionid ,sPath ,self.request.getQueryString() ) )