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

Changeset 1071

Show
Ignore:
Timestamp:
04/25/06 11:59:41
Author:
fumanchu
Message:

New 'root' arg to get_object_trail to allow dispatch from arbitrary points in the tree.

Files:

Legend:

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

    r1070 r1071  
    99from cherrypy.lib import httptools 
    1010 
    11 def get_object_trail(objectpath=None): 
    12     """ 
    13     List of (name, object) pairs, from cherrypy.root to the current object
     11 
     12def get_object_trail(objectpath=None, root=None): 
     13    """List of (name, object) pairs, from root (cherrypy.root) down objectpath
    1414     
    1515    If any named objects are unreachable, (name, None) pairs are used. 
     
    3939        return [('root', cherrypy.root), ('global_', gh), ('index', None)] 
    4040     
    41     nameList = ['root'] + nameList + ['index'] 
     41    if root is None: 
     42        root = getattr(cherrypy, 'root', None) 
     43        if root is None: 
     44            return [('root', None), ('index', None)] 
     45     
     46    nameList.append('index') 
    4247     
    4348    # Convert the list of names into a list of objects 
    44     node = cherrypy 
     49    node = root 
    4550    objectTrail = [] 
    4651    for name in nameList: 

Hosted by WebFaction

Log in as guest/cpguest to create tickets