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

Changeset 1452

Show
Ignore:
Timestamp:
11/27/06 16:34:50
Author:
fumanchu
Message:

"Fix" (warning) for #607 (Hanging server).

Files:

Legend:

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

    r1435 r1452  
    1818import threading 
    1919import types 
     20from warnings import warn 
    2021 
    2122import cherrypy 
     
    227228    LOCK_SUFFIX = '.lock' 
    228229     
     230    def __init__(self, id=None, **kwargs): 
     231        Session.__init__(self, id, **kwargs) 
     232         
     233        # Warn if any lock files exist at startup. 
     234        lockfiles = [fname for fname in os.listdir(self.storage_path) 
     235                     if (fname.startswith(self.SESSION_PREFIX) 
     236                         and fname.endswith(self.LOCK_SUFFIX))] 
     237        if lockfiles: 
     238            plural = ('', 's')[len(lockfiles) > 1] 
     239            warn("%s session lockfile%s found at startup. If you are " 
     240                 "only running one process, then you may need to " 
     241                 "manually delete the lockfiles found at %r." 
     242                 % (len(lockfiles), plural, 
     243                    os.path.abspath(self.storage_path))) 
     244     
    229245    def _get_file_path(self): 
    230246        return os.path.join(self.storage_path, self.SESSION_PREFIX + self.id) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets