Commits

Robert Brewer committed 6502e2b

More-meaningful config syntax errors.

Comments (0)

Files changed (2)

cherrypy/_cpconfig.py

                 try:
                     value = unrepr(value)
                 except Exception, x:
-                    msg = ("Config error in section: %s, option: %s, value: %s" %
-                           (repr(section), repr(option), repr(value)))
+                    msg = ("Config error in section: %r, option: %r, "
+                           "value: %r. Config values must be valid Python." %
+                           (section, option, value))
                     raise ValueError(msg, x.__class__.__name__, x.args)
                 result[section][option] = value
         return result

cherrypy/lib/__init__.py

         # e.g. IronPython 1.0.
         return eval(s)
     
-    p = compiler.parse("a=" + s)
+    p = compiler.parse("__tempvalue__ = " + s)
     obj = p.getChildren()[1].getChildren()[0].getChildren()[1]
     
     return _Builder().build(obj)