Mercurial > genshi > mirror
diff genshi/template/loader.py @ 770:c290dc5a6813 stable-0.5.x
Ported [894] and [895] back to 0.5.x branch.
author | cmlenz |
---|---|
date | Tue, 01 Jul 2008 10:42:57 +0000 |
parents | e922f7190eea |
children | e01c9ad52f09 |
line wrap: on
line diff
--- a/genshi/template/loader.py +++ b/genshi/template/loader.py @@ -163,8 +163,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 +187,6 @@ except (KeyError, OSError): pass - search_path = self.search_path isabs = False if os.path.isabs(filename):