Robert Brewer avatar 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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.