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

Changeset 799

Show
Ignore:
Timestamp:
11/08/05 16:18:40
Author:
fumanchu
Message:

Fix for broken errorPage tests in Python 2.4.

Files:

Legend:

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

    r790 r799  
    228228    # so don't bother cleaning up response values here. 
    229229    response.status = status 
     230    response.body = getErrorPage(status, traceback=tb, message=message) 
     231    response.headerMap['Content-Length'] = len(response.body) 
    230232    response.headerMap['Content-Type'] = "text/html" 
    231     response.body = getErrorPage(status, traceback=tb, message=message) 
    232233     
    233234    be_ie_unfriendly(status) 
    234      
    235     response.headerMap['Content-Length'] = len(response.body) 
    236235 
    237236 
     
    265264        else: 
    266265            response.body = [content] 
     266        response.headerMap['Content-Length'] = len(response.body[0]) 
    267267 
    268268def formatExc(exc=None): 
  • trunk/cherrypy/test/helper.py

    r768 r799  
    136136         
    137137        from cherrypy._cputil import getErrorPage 
    138         esc = re.escape 
     138         
    139139        # This will never contain a traceback: 
    140         page = esc(getErrorPage(status, message=message)
     140        page = getErrorPage(status, message=message
    141141         
    142142        # First, test the response body without checking the traceback. 
    143143        # Stick a match-all group (.*) in to grab the traceback. 
    144         page = page.replace(esc('<pre id="traceback"></pre>'), 
    145                             esc('<pre id="traceback">') + '(.*)' + esc('</pre>')) 
    146         m = re.match(page, self.body, re.DOTALL) 
     144        esc = re.escape 
     145        epage = esc(page) 
     146        epage = epage.replace(esc('<pre id="traceback"></pre>'), 
     147                              esc('<pre id="traceback">') 
     148                              + '(.*)' + esc('</pre>')) 
     149        m = re.match(epage, self.body, re.DOTALL) 
    147150        if not m: 
    148151            self._handlewebError('Error page does not match\n' + page) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets