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

Changeset 1154

Show
Ignore:
Timestamp:
06/21/06 17:50:00
Author:
fumanchu
Message:

Quick and dirty trap of log file errors.

Files:

Legend:

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

    r1146 r1154  
    112112    if fname: 
    113113        f = open(fname, 'ab') 
    114         f.write(s + '\n') 
    115         f.close() 
     114        try: 
     115            f.write(s + '\n') 
     116        finally: 
     117            f.close() 
    116118 
    117119_log_severity_levels = {0: "INFO", 1: "WARNING", 2: "ERROR"} 
     
    137139    if fname: 
    138140        f = open(fname, 'ab') 
    139         f.write(s + '\n') 
    140         f.close() 
     141        try: 
     142            f.write(s + '\n') 
     143        finally: 
     144            f.close() 
    141145 
    142146def log(msg='', context='', severity=0, traceback=False): 
  • trunk/cherrypy/test/test_static.py

    r1148 r1154  
    128128        self.getPage("/static/dirback.jpg", headers=[ims]) 
    129129        self.assertStatus(304) 
    130 ##         
    131 ##        # Test lots of requests for the same file (no If-Mod). 
    132 ##        ts = [] 
    133 ##        for x in xrange(500): 
    134 ##            t = threading.Thread(target=self.getPage, 
    135 ##                                 args=("/static/dirback.jpg",)) 
    136 ##            ts.append(t) 
    137 ##            t.start() 
    138 ##        for t in ts: 
    139 ##            t.join() 
    140 ## 
     130 
    141131 
    142132if __name__ == "__main__": 

Hosted by WebFaction

Log in as guest/cpguest to create tickets