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

Changeset 644

Show
Ignore:
Timestamp:
09/14/05 02:20:41
Author:
fumanchu
Message:

Removed redundant lines in _cputil.

Files:

Legend:

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

    r639 r644  
    174174 
    175175class HTTPError(Error): 
    176     """ Exception raised when the client has made an error in its request. 
     176    """ Exception used to return an HTTP error code to the client. 
    177177        This exception will automatically set the response status and body. 
    178178         
    179         A custom body can be pased to the init method in place of the standard error page. 
     179        A custom body can be pased to the init method in place of the 
     180        standard error page. 
    180181    """ 
    181182     
     
    191192 
    192193        if body is _missing: 
    193             # because the init method is called before the exception is raised 
    194             # it is impossible to embed the traceback in the error page at this point. 
    195             # We use a generator so that the error page is generated at a later point ( 
    196             # after the exception is raised). 
    197             cherrypy.response.body = self.pageGenerator() 
    198         else: 
    199             cherrypy.response.body = body 
     194            # because the init method is called before the exception 
     195            # is raised it is impossible to embed the traceback in the 
     196            # error page at this point. We use a generator so that the 
     197            # error page is generated at a later point (after the 
     198            # exception is raised). 
     199            body = self.pageGenerator() 
     200         
     201        cherrypy.response.body = body 
    200202     
    201203    def __str__(self): 
  • trunk/cherrypy/_cputil.py

    r642 r644  
    210210    return "".join(traceback.format_exception(*exc)) 
    211211 
    212 def getErrorStatusAndPage(status, traceback = None): 
    213     statusString, message = _HTTPResponses[status] 
    214     statusString = '%d %s' % (status, statusString) 
    215      
    216     if traceback is None: 
    217         traceback = '' 
    218         # get the traceback from formatExc 
    219         developmentMode = (cherrypy.config.get('server.environment') == 'development') 
    220         if cherrypy.config.get('server.showTracebacks') or developmentMode: 
    221             traceback = formatExc() 
    222      
    223     page = _HTTPErrorTemplate(statusString, message, traceback, cherrypy.__version__) 
    224      
    225     return statusString, page 
    226  
    227     """formatExc(exc=None) -> exc (or sys.exc_info), formatted.""" 
    228     if exc is None: 
    229         exc = sys.exc_info() 
    230      
    231     if exc == (None, None, None): 
    232         return "" 
    233  
    234     return "".join(traceback.format_exception(*exc)) 
    235  
    236212def _cpOnError(): 
    237213    """ Default _cpOnError method """ 

Hosted by WebFaction

Log in as guest/cpguest to create tickets