Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 2051

Show
Ignore:
Timestamp:
10/30/08 10:05:37
Author:
lakin
Message:

Allow apps to be mounted with the same script_name passed in as they are already instantiated with. Fumanchu asked for this earlier, or at least wondered about it. I realized it would allow apps to be compatible with both CP 3.1 and CP Trunk so I added it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cptree.py

    r2049 r2051  
    171171        if isinstance(root, Application): 
    172172            app = root 
    173             if script_name != ""
    174                 raise ValueError, "Cannot specify a script name and pass an Application instance to cherrypy.mount" 
     173            if script_name != "" and script_name != app.script_name
     174                raise ValueError, "Cannot specify a different script name and pass an Application instance to cherrypy.mount" 
    175175            script_name = app.script_name 
    176176        else: 
  • trunk/cherrypy/test/test_objectmapping.py

    r2049 r2051  
    332332        self.assertRaises(ValueError, cherrypy.tree.mount, a, '/somewhereelse') 
    333333 
     334        # When mounting an application instance,  
     335        # we can't specify a script name in the call to mount. 
     336        a = Application(object(), '/somewhere') 
     337        try: 
     338            cherrypy.tree.mount(a, '/somewhere') 
     339        except ValueError: 
     340            self.fail("tree.mount must allow script_names which are the same") 
     341 
    334342        try: 
    335343            cherrypy.tree.mount(a) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets