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

Changeset 936

Show
Ignore:
Timestamp:
01/25/06 01:54:45
Author:
fumanchu
Message:

Fix for #446 (tree.mount should optionally set its own baseurl from config).

Files:

Legend:

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

    r923 r936  
    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 
     24         
     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 
    2434         
    2535        point = baseurl.lstrip("/") 
     
    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): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets