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

Changeset 839

Show
Ignore:
Timestamp:
11/26/05 16:51:20
Author:
fumanchu
Message:

Got rid of some superfluous custom exceptions.

Files:

Legend:

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

    r837 r839  
    88class NotReady(Error): 
    99    """A request was made before the app server has been started.""" 
    10     pass 
    11  
    12 class WrongResponseType(Error): 
    13     """ Happens when the cherrypy.response.body is not a string """ 
    14     pass 
    15  
    16 class WrongUnreprValue(Error): 
    17     """ Happens when unrepr can't parse a value """ 
    1810    pass 
    1911 
  • trunk/cherrypy/config.py

    r816 r839  
    203203            try: 
    204204                value = cptools.unrepr(value) 
    205             except cherrypy.WrongUnreprValue, s
     205            except Exception, x
    206206                msg = ("section: %s, option: %s, value: %s" % 
    207207                       (repr(section), repr(option), repr(value))) 
    208                 raise cherrypy.WrongConfigValue(msg) 
     208                e = cherrypy.WrongConfigValue(msg) 
     209                e.args += (x.__class__.__name__, x.args) 
     210                raise e 
    209211            result[section][option] = value 
    210212    return result 
  • trunk/cherrypy/lib/cptools.py

    r837 r839  
    284284    if not s: 
    285285        return s 
    286     try: 
    287         return Builder().build(getObj(s)) 
    288     except: 
    289         raise cherrypy.WrongUnreprValue(repr(s)) 
    290  
     286    return Builder().build(getObj(s)) 
     287 
  • trunk/cherrypy/test/test_config.py

    r823 r839  
    33test.prefer_parent_path() 
    44 
     5import StringIO 
    56import cherrypy 
    67 
     
    7374            self.assertBody(expected) 
    7475     
     76    def testUnrepr(self): 
     77        self.assertRaises(cherrypy.WrongConfigValue, cherrypy.config.update, 
     78                          file=StringIO.StringIO(""" 
     79[global] 
     80server.environment = production 
     81""")) 
     82     
    7583    def testEnvironments(self): 
    7684        for key, val in cherrypy.config.environments['development'].iteritems(): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets