From 4f97b61c425b620ffca190f130625c84c5754475 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 26 Mar 2012 17:58:06 -0400 Subject: [PATCH] speculative fix for issue #512 --- pyramid/mako_templating.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index b2db28ba78..c4c12f02a9 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -33,7 +33,9 @@ def adjust_uri(self, uri, relativeto): """Called from within a Mako template, avoids adjusting the uri if it looks like an asset specification""" # Don't adjust asset spec names - if ':' in uri: + isabs = os.path.isabs(uri) + if (not isabs) and (':' in uri): + # fbo asset specs on windows: cant have colons in filename return uri return TemplateLookup.adjust_uri(self, uri, relativeto) @@ -48,16 +50,17 @@ def get_template(self, uri): """ isabs = os.path.isabs(uri) if (not isabs) and (':' in uri): + adjusted = uri.replace(':', '_') try: if self.filesystem_checks: - return self._check(uri, self._collection[uri]) + return self._check(adjusted, self._collection[adjusted]) else: - return self._collection[uri] + return self._collection[adjusted] except KeyError: pname, path = resolve_asset_spec(uri) srcfile = abspath_from_asset_spec(path, pname) if os.path.isfile(srcfile): - return self._load(srcfile, uri) + return self._load(srcfile, adjusted) raise exceptions.TopLevelLookupException( "Can not locate template for uri %r" % uri) return TemplateLookup.get_template(self, uri)