Skip to content

Commit

Permalink
speculative fix for issue Pylons#512
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Mar 26, 2012
1 parent ae5ab35 commit 4f97b61
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pyramid/mako_templating.py
Expand Up @@ -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)

Expand All @@ -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)
Expand Down

0 comments on commit 4f97b61

Please sign in to comment.