# HG changeset patch # User k0s # Date 1261882375 18000 # Node ID 3ddb2ca121788bb95a8a366b0cd2a24022a779ad # Parent c7819dbf7733dd3188db4ee7b1e52a1cf18c93a9 allow for multiple template directories diff -r c7819dbf7733 -r 3ddb2ca12178 bitsyblog/bitsyblog.py --- a/bitsyblog/bitsyblog.py Sat Dec 26 21:45:28 2009 -0500 +++ b/bitsyblog/bitsyblog.py Sat Dec 26 21:52:55 2009 -0500 @@ -53,6 +53,7 @@ 'n_links': 5, # number of links for navigation 'site_name': 'bitsyblog', 'header': None, + 'template_directories': '', 'auto_reload': 'True', 'help_file': None, } @@ -75,8 +76,13 @@ self.cooker = self.restructuredText # template renderer - self.loader = TemplateLoader(resource_filename(__name__, 'templates'), - auto_reload=self.auto_reload.lower()=='true') + self.auto_reload = self.auto_reload.lower()=='true' + self.template_directories = self.template_directories.split() # no spaces in directory names, for now + assert sum([os.path.isdir(directory) for directory in self.template_directories]) == len(self.template_directories) + self.template_directories.append(resource_filename(__name__, 'templates')) + self.loader = TemplateLoader(self.template_directories, + auto_reload=self.auto_reload) + # helpfile if self.help_file and os.path.exists(self.help_file): diff -r c7819dbf7733 -r 3ddb2ca12178 bitsyblog/factory.py --- a/bitsyblog/factory.py Sat Dec 26 21:45:28 2009 -0500 +++ b/bitsyblog/factory.py Sat Dec 26 21:52:55 2009 -0500 @@ -3,10 +3,11 @@ from getpass import getpass from paste.httpexceptions import HTTPExceptionHandler +# accepted configuration keys, e.g. 'bitsyblog.file_dir' +config = [ 'file_dir', 'date_format', 'subject', 'n_links', 'help_file', 'header', 'template_directories' ] + def factory(global_conf, **app_conf): """make bitsyauth app and wrap it in middleware""" - - config = [ 'file_dir', 'date_format', 'subject', 'n_links', 'help_file' ] key_str = 'bitsyblog.%s' args = dict([ (key, app_conf[ key_str % key]) for key in config if app_conf.has_key(key_str % key) ]) @@ -17,7 +18,6 @@ def bitsierfactory(global_conf, **app_conf): """make single-user bitsyblog""" - config = [ 'file_dir', 'date_format', 'subject', 'n_links', 'help_file', 'header' ] key_str = 'bitsyblog.%s' args = dict([ (key, app_conf[ key_str % key]) for key in config if app_conf.has_key(key_str % key) ])