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

Changeset 1737

Show
Ignore:
Timestamp:
10/04/07 10:47:30
Author:
fumanchu
Message:

Test and fix for #737 (not possible to have custom request handler on application mount point).

Files:

Legend:

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

    r1723 r1737  
    627627        # dispatchers can only be specified in app.config, not in _cp_config 
    628628        # (since custom dispatchers may not even have an app.root). 
    629         trail = path 
     629        trail = path or "/" 
    630630        while trail: 
    631631            nodeconf = self.app.config.get(trail, {}) 
  • trunk/cherrypy/test/test_objectmapping.py

    r1728 r1737  
    133133    Root.collection = Collection() 
    134134     
     135    d = cherrypy.dispatch.MethodDispatcher() 
    135136    for url in script_names: 
    136         d = cherrypy.dispatch.MethodDispatcher() 
    137137        conf = {'/': {'user': (url or "/").split("/")[-2]}, 
    138138                '/bymethod': {'request.dispatch': d}, 
     
    150150     
    151151    cherrypy.tree.mount(Isolated(), "/isolated") 
     152     
     153    class AnotherApp: 
     154         
     155        exposed = True 
     156         
     157        def GET(self): 
     158            return "milk" 
     159     
     160    cherrypy.tree.mount(AnotherApp(), "/app", {'/': {'request.dispatch': d}}) 
    152161 
    153162 
     
    309318        self.getPage("/collection", method="GET") 
    310319        self.assertBody("['a', 'bit', 'silly']") 
     320         
     321        # Test custom dispatcher set on app root (see #737). 
     322        self.getPage("/app") 
     323        self.assertBody("milk") 
    311324 
    312325 

Hosted by WebFaction

Log in as guest/cpguest to create tickets