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

Changeset 1220

Show
Ignore:
Timestamp:
08/05/06 18:23:54
Author:
fumanchu
Message:

Fix for #438 (autoreload.py: Server fails to start if a .pyc is imported with no corresponding .py).

Files:

Legend:

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

    r1214 r1220  
    126126                    filename = filename[:-1] 
    127127                 
     128                oldtime = self.mtimes.get(filename, 0) 
     129                if oldtime is None: 
     130                    # Module with no .py file. Skip it. 
     131                    continue 
     132                 
    128133                try: 
    129134                    mtime = os.stat(filename).st_mtime 
    130135                except OSError: 
    131                     if filename in self.mtimes: 
    132                         # The file was probably deleted. 
     136                    # Either a module with no .py file, or it's been deleted. 
     137                    mtime = None 
     138                 
     139                if filename not in self.mtimes: 
     140                    # If a module has no .py file, this will be None. 
     141                    self.mtimes[filename] = mtime 
     142                else: 
     143                    if mtime is None or mtime > oldtime: 
     144                        # The file has been deleted or modified. 
    133145                        self.reexec() 
    134                  
    135                 if filename not in self.mtimes: 
    136                     self.mtimes[filename] = mtime 
    137                     continue 
    138                  
    139                 if mtime > self.mtimes[filename]: 
    140                     # The file has been modified. 
    141                     self.reexec() 
    142146     
    143147    def stop(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets