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

Ticket #446: conf_mount_point.patch

  • _cptree.py

    old new  
    1818    def __init__(self): 
    1919        self.mount_points = {} 
    2020     
    21     def mount(self, app_root, baseurl="/", conf=None): 
     21    def mount(self, app_root, baseurl=None, conf=None): 
    2222        """Mount the given app_root at the given baseurl (relative to root).""" 
    2323        import cherrypy 
    2424         
     25        if conf and not isinstance(conf, dict): 
     26            conf = cherrypy.config.dict_from_config_file(conf) 
     27         
     28        if baseurl is None: 
     29            baseurl = "/" 
     30            if conf: 
     31                conf_pt = conf.get("global", {}).get("mount_point") 
     32                if conf_pt: 
     33                    baseurl = conf_pt 
     34         
    2535        point = baseurl.lstrip("/") 
    2636        if point: 
    2737            node = cherrypy.root 
     
    4656        self.mount_points[baseurl] = app_root 
    4757         
    4858        if conf is not None: 
    49             if isinstance(conf, dict): 
    50                 cherrypy.config.update(updateMap=conf, baseurl=baseurl) 
    51             else: 
    52                 cherrypy.config.update(file=conf, baseurl=baseurl) 
     59            cherrypy.config.update(updateMap=conf, baseurl=baseurl) 
    5360     
    5461    def mount_point(self, path=None): 
    5562        """The 'root path' of the app which governs the given path, or None. 

Hosted by WebFaction

Log in as guest/cpguest to create tickets