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

Changeset 1139

Show
Ignore:
Timestamp:
06/12/06 01:10:31
Author:
fumanchu
Message:

Got rid of _cperror.Error base class, and "from _cperror import *" in top level.

Files:

Legend:

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

    r1135 r1139  
    44 
    55 
    6 from _cperror import * 
     6from _cperror import HTTPError, HTTPRedirect, InternalRedirect, NotFound, WrongConfigValue 
    77import config 
    88 
     
    140140    """ 
    141141    if traceback: 
    142         msg += format_exc() 
     142        import _cperror 
     143        msg += _cperror.format_exc() 
    143144    logfunc = config.get('log_function', _log_message) 
    144145    logfunc(msg, context, severity) 
  • trunk/cherrypy/_cperror.py

    r1137 r1139  
    11"""Error classes for CherryPy.""" 
    22 
    3 # cherrypy imports this module as *, so hide nonessentials. 
    43from cgi import escape as _escape 
    54from sys import exc_info as _exc_info 
     
    87 
    98 
    10 class Error(Exception): 
    11     pass 
    12  
    13 class WrongConfigValue(Error): 
     9class WrongConfigValue(Exception): 
    1410    """ Happens when a config value can't be parsed, or is otherwise illegal. """ 
    1511    pass 
     
    127123 
    128124 
    129 class HTTPError(Error): 
     125class HTTPError(Exception): 
    130126    """ Exception used to return an HTTP error code to the client. 
    131127        This exception will automatically set the response status and body. 
     
    140136            raise ValueError("status must be between 400 and 599.") 
    141137        self.message = message 
    142         Error.__init__(self, status, message) 
     138        Exception.__init__(self, status, message) 
    143139     
    144140    def set_response(self): 
  • trunk/cherrypy/_cprequest.py

    r1137 r1139  
    88import cherrypy 
    99from cherrypy import _cpcgifs 
     10from cherrypy._cperror import format_exc, bare_error 
    1011from cherrypy.lib import httptools, profiler 
    1112 
     
    368369            dbltrace = ("\n===First Error===\n\n%s" 
    369370                        "\n\n===Second Error===\n\n%s\n\n") 
    370             body = dbltrace % (cherrypy.format_exc(exc), 
    371                                cherrypy.format_exc()) 
     371            body = dbltrace % (format_exc(exc), format_exc()) 
    372372        else: 
    373373            body = "" 
    374         r = cherrypy.bare_error(body) 
     374        r = bare_error(body) 
    375375        response.status, response.header_list, response.body = r 
    376376 

Hosted by WebFaction

Log in as guest/cpguest to create tickets