Mercurial > genshi > mirror
diff genshi/template/loader.py @ 784:ea46fb523485 experimental-match-fastpaths
update to 0.5.x branch, up through r907
don't know how this fits in with SoC work, but I wanted to do due diligence and keep this branch working in case it someday gets considered for trunk
author | aflett |
---|---|
date | Mon, 21 Jul 2008 23:17:52 +0000 |
parents | 919809e55d16 |
children |
line wrap: on
line diff
--- a/genshi/template/loader.py +++ b/genshi/template/loader.py @@ -22,7 +22,8 @@ from genshi.template.base import TemplateError from genshi.util import LRUCache -__all__ = ['TemplateLoader', 'TemplateNotFound'] +__all__ = ['TemplateLoader', 'TemplateNotFound', 'directory', 'package', + 'prefixed'] __docformat__ = 'restructuredtext en' @@ -163,8 +164,14 @@ """ if cls is None: cls = self.default_class - if relative_to and not os.path.isabs(relative_to): + search_path = self.search_path + + # Make the filename relative to the template file its being loaded + # from, but only if that file is specified as a relative path, or no + # search path has been set up + if relative_to and (not search_path or not os.path.isabs(relative_to)): filename = os.path.join(os.path.dirname(relative_to), filename) + filename = os.path.normpath(filename) cachekey = filename @@ -181,7 +188,6 @@ except (KeyError, OSError): pass - search_path = self.search_path isabs = False if os.path.isabs(filename):