Commits

Anonymous committed 4bb7b2a

#884 - cpchecker method to catch application configuration that starts with script-name

Comments (0)

Files changed (1)

cherrypy/_cpchecker.py

     # This value should be set inside _cpconfig.
     global_config_contained_paths = False
     
+    def check_app_config_entries_dont_start_with_script_name(self):
+        for sn, app in cherrypy.tree.apps.iteritems():
+            if not isinstance(app, cherrypy.Application):
+                continue
+            if not app.config:
+                continue
+            if sn == '':
+                continue
+            for key in app.config.keys():
+                if key.startswith(sn):
+                    warnings.warn(
+                        "The application mounted at %r has config " \
+                        "entries that start with its script name: %r" % (sn, key))
+
     def check_skipped_app_config(self):
         for sn, app in cherrypy.tree.apps.iteritems():
             if not isinstance(app, cherrypy.Application):