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

Changeset 2049

Show
Ignore:
Timestamp:
10/15/08 12:15:15
Author:
lakin
Message:

Dissallow script_name in cherrypy.tree.mount when an instance of Application is passed in

Files:

Legend:

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

    r2039 r2049  
    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" 
     175            script_name = app.script_name 
    173176        else: 
    174177            app = Application(root, script_name) 
  • trunk/cherrypy/test/test_objectmapping.py

    r2030 r2049  
    11from cherrypy.test import test 
     2from cherrypy._cptree import Application 
    23test.prefer_parent_path() 
    34 
     
    324325        self.assertBody("milk") 
    325326 
     327    def testTreeMounting(self): 
     328 
     329        # When mounting an application instance,  
     330        # we can't specify a script name in the call to mount. 
     331        a = Application(object(), '/somewhere') 
     332        self.assertRaises(ValueError, cherrypy.tree.mount, a, '/somewhereelse') 
     333 
     334        try: 
     335            cherrypy.tree.mount(a) 
     336        except ValueError: 
     337            self.fail("cherrypy.tree.mount incorrectly raised a ValueError") 
     338 
     339 
     340 
     341 
    326342 
    327343if __name__ == "__main__": 

Hosted by WebFaction

Log in as guest/cpguest to create tickets