diff -r 051afb721c22 -r 155f43a0fa68 app/soc/views/helpers/template_helpers.py --- a/app/soc/views/helpers/template_helpers.py Fri Aug 29 04:24:31 2008 +0000 +++ b/app/soc/views/helpers/template_helpers.py Sat Aug 30 02:54:22 2008 +0000 @@ -22,7 +22,8 @@ ] -def makeSiblingTemplatesList(templates, new_template_file): +def makeSiblingTemplatesList(templates, new_template_file, + default_template=None): """Converts template paths into a list of "sibling" templates. Args: @@ -31,7 +32,9 @@ template file name of each template) new_template_file: new "sibling" template file to append to each extracted template path - + default_template: a default template (or a list of them) to append to the + end of the generated "sibling" template paths; default is None + Returns: A list of potential "sibling" templates named by new_template_file located in the paths of the templates in the supplied list. For example, from: @@ -42,5 +45,13 @@ if not isinstance(templates, (list, tuple)): templates = [templates] - return [ - '%s/%s' % (t.rsplit('/', 1)[0], new_template_file) for t in templates] + if default_template is None: + default_template = [] + + if not isinstance(default_template, (list, tuple)): + default_template = [default_template] + + sibling_templates = [ + '%s/%s' % (t.rsplit('/', 1)[0], new_template_file) for t in templates] + + return sibling_templates + default_template