Commits

Robert Brewer committed b61134c

Fix for #716 (Checker should warn on unknown tool).

Comments (0)

Files changed (2)

cherrypy/_cpchecker.py

                     atoms = k.split(".")
                     if len(atoms) > 1:
                         if atoms[0] not in ns:
+                            # Spit out a special warning if a known
+                            # namespace is preceded by "cherrypy."
                             if (atoms[0] == "cherrypy" and atoms[1] in ns):
                                 msg = ("The config entry %r is invalid; "
                                        "try %r instead.\nsection: [%s]"
                                        "the %r config namespace is unknown.\n"
                                        "section: [%s]" % (k, atoms[0], section))
                             warnings.warn(msg)
+                        elif atoms[0] == "tools":
+                            if atoms[1] not in dir(cherrypy.tools):
+                                msg = ("The config entry %r may be invalid, "
+                                       "because the %r tool was not found.\n"
+                                       "section: [%s]" % (k, atoms[1], section))
+                                warnings.warn(msg)
     
     def check_config_namespaces(self):
         """Process config and warn on each unknown config namespace."""

cherrypy/test/checkerdemo.py

             '/cpknown': {'cherrypy.tools.encode.on': True},
             # Warn on mismatched types
             '/conftype': {'request.show_tracebacks': 14},
+            # Warn on unknown tool.
+            '/web': {'tools.unknown.on': True},
             }
     cherrypy.quickstart(Root(), config=conf)
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.