Changeset 5119

Show
Ignore:
Timestamp:
08/10/08 11:35:29 (5 months ago)
Author:
mramm
Message:

Updating config.py so that the paths are customizable without overiding any methods on AppConfig?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tg/config.py

    r5118 r5119  
    5656        self.auth_backend = None 
    5757        self.serve_static = True 
     58        self.paths = Bunch() 
    5859     
    5960    def setup_paths(self): 
    60         root = os.path.dirname(os.path.abspath( 
    61                 self.package.__file__)) 
    62         self.paths = dict(root=root, 
     61        root = os.path.dirname(os.path.abspath(self.package.__file__)) 
     62        # The default paths: 
     63        paths = dict(root=root, 
    6364                     controllers=os.path.join(root, 'controllers'), 
    6465                     static_files=os.path.join(root, 'public'), 
    6566                     templates=[os.path.join(root, 'templates')]) 
     67        # If the user defined custom paths, then use them instead of the 
     68        # default ones: 
     69        paths.update(self.paths) 
     70        self.paths = paths 
    6671                      
    6772    def init_config(self, global_conf, app_conf):