Source

CherryPy / cherrypy / _cptree.py

Diff from to

cherrypy/_cptree.py

         
         root: an instance of a "controller class" (a collection of page
             handler methods) which represents the root of the application.
+            This may also be an Application instance, or None if using
+            a dispatcher other than the default.
         script_name: a string containing the "mount point" of the application.
             This should start with a slash, and be the path portion of the
             URL at which to mount the given root. For example, if root.index()
         
         if isinstance(root, Application):
             app = root
+            if script_name != "" and script_name != app.script_name:
+                raise ValueError, "Cannot specify a different script name and pass an Application instance to cherrypy.mount"
+            script_name = app.script_name
         else:
             app = Application(root, script_name)
             
             # If mounted at "", add favicon.ico
-            if script_name == "" and root and not hasattr(root, "favicon_ico"):
+            if (script_name == "" and root is not None
+                    and not hasattr(root, "favicon_ico")):
                 favicon = os.path.join(os.getcwd(), os.path.dirname(__file__),
                                        "favicon.ico")
                 root.favicon_ico = tools.staticfile.handler(favicon)
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.