Changeset 839
- Timestamp:
- 11/26/05 16:51:20
- Files:
-
- trunk/cherrypy/_cperror.py (modified) (1 diff)
- trunk/cherrypy/config.py (modified) (1 diff)
- trunk/cherrypy/lib/cptools.py (modified) (1 diff)
- trunk/cherrypy/test/test_config.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cperror.py
r837 r839 8 8 class NotReady(Error): 9 9 """A request was made before the app server has been started.""" 10 pass11 12 class WrongResponseType(Error):13 """ Happens when the cherrypy.response.body is not a string """14 pass15 16 class WrongUnreprValue(Error):17 """ Happens when unrepr can't parse a value """18 10 pass 19 11 trunk/cherrypy/config.py
r816 r839 203 203 try: 204 204 value = cptools.unrepr(value) 205 except cherrypy.WrongUnreprValue, s:205 except Exception, x: 206 206 msg = ("section: %s, option: %s, value: %s" % 207 207 (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 209 211 result[section][option] = value 210 212 return result trunk/cherrypy/lib/cptools.py
r837 r839 284 284 if not s: 285 285 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 3 3 test.prefer_parent_path() 4 4 5 import StringIO 5 6 import cherrypy 6 7 … … 73 74 self.assertBody(expected) 74 75 76 def testUnrepr(self): 77 self.assertRaises(cherrypy.WrongConfigValue, cherrypy.config.update, 78 file=StringIO.StringIO(""" 79 [global] 80 server.environment = production 81 """)) 82 75 83 def testEnvironments(self): 76 84 for key, val in cherrypy.config.environments['development'].iteritems():

