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

Changeset 1750

Show
Ignore:
Timestamp:
10/16/07 12:53:29
Author:
fumanchu
Message:

Added an HTTPError.get_error_page for easier overriding.

Files:

Legend:

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

    r1657 r1750  
    66from cherrypy.lib import http as _http 
    77 
     8 
    89class CherryPyException(Exception): 
     10    pass 
     11 
     12 
     13class TimeoutError(CherryPyException): 
     14    """Exception raised when Response.timed_out is detected.""" 
    915    pass 
    1016 
     
    186192        if cherrypy.request.show_tracebacks: 
    187193            tb = format_exc() 
    188         content = get_error_page(self.status, traceback=tb, 
    189                                  message=self.message) 
     194        respheaders['Content-Type'] = "text/html" 
     195         
     196        content = self.get_error_page(self.status, traceback=tb, 
     197                                      message=self.message) 
    190198        response.body = content 
    191199        respheaders['Content-Length'] = len(content) 
    192         respheaders['Content-Type'] = "text/html" 
    193200         
    194201        _be_ie_unfriendly(self.status) 
     202     
     203    def get_error_page(self, *args, **kwargs): 
     204        return get_error_page(*args, **kwargs) 
    195205     
    196206    def __call__(self): 
     
    208218        self.args = (path,) 
    209219        HTTPError.__init__(self, 404, "The path %r was not found." % path) 
    210  
    211  
    212 class TimeoutError(CherryPyException): 
    213     """Exception raised when Response.timed_out is detected.""" 
    214     pass 
    215220 
    216221 

Hosted by WebFaction

Log in as guest/cpguest to create tickets