Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 582

Show
Ignore:
Timestamp:
08/31/05 11:19:49
Author:
rdelon
Message:

Small improvements to new session implementation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/filter/sessionfilter.py

    r581 r582  
    2828 
    2929""" Session implementation for CherryPy. 
    30 We use cherrypy.threadData (td) to store some sonvenient variables as 
     30We use cherrypy.threadData (td) to store some convenient variables as 
    3131well as data about the session for the current request. 
    3232 
    3333Variables used to store config options: 
    34  
    3534    - td._sessionTimeout: timeout delay for the session 
    3635    - td._sessionLocking: mechanism used to lock the session ('implicit' or 'explicit') 
     
    125124                td._sessionID, (td._sessionData, expirationTime)) 
    126125        try: 
    127             # Always try to release the lock in the end 
     126            # Always try to release the lock at the end 
    128127            td._sessionStorage.releaseLock() 
    129128        except: 
     
    141140class RamStorage: 
    142141    """ Implementation of the RAM backend for sessions """ 
     142    def __init__(self): 
     143        try: 
     144            cherrypy._sessionDataHolder 
     145        except: 
     146            cherrypy._sessionDataHolder = {} 
     147        try: 
     148            cherrypy._sessionLockDict 
     149        except: 
     150            cherrypy._sessionLockDict = {} 
     151 
    143152    def load(self, id): 
    144         try: 
    145             cherrypy._sessionDataHolder 
    146         except: 
    147             cherrypy._sessionDataHolder = {} 
    148153        return cherrypy._sessionDataHolder.get(id) 
    149154    def save(self, id, data): 
    150         try: 
    151             cherrypy._sessionDataHolder 
    152         except: 
    153             cherrypy._sessionDataHolder = {} 
    154155        cherrypy._sessionDataHolder[id] = data 
    155156    def acquireLock(self): 
    156         try: 
    157             cherrypy._sessionLockDict 
    158         except: 
    159             cherrypy._sessionLockDict = {} 
    160157        id = cherrypy.session['_id'] 
    161158        lock = cherrypy._sessionLockDict.get(id) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets