summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordonkopotamus <derek.harland@finq.co.nz>2014-01-07 13:58:24 +1300
committerdonkopotamus <derek.harland@finq.co.nz>2014-01-07 13:58:24 +1300
commitbfc5f2c97b2f6d1af70e8d098f926fe110d16ea0 (patch)
tree281b6d2f2b6afef23d812c08907cf07c6a953272
parent1504fc60e4b676aeec2ccc3121d7462bc885545f (diff)
downloadmako-bfc5f2c97b2f6d1af70e8d098f926fe110d16ea0.tar.gz
Revert "Move calculation of normalised uri to the codepath where it is actually used"
This reverts commit 1504fc60e4b676aeec2ccc3121d7462bc885545f.
-rw-r--r--mako/template.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/mako/template.py b/mako/template.py
index bb5d891..3a7b7f0 100644
--- a/mako/template.py
+++ b/mako/template.py
@@ -255,6 +255,16 @@ class Template(object):
self.module_id = "memory:" + hex(id(self))
self.uri = self.module_id
+ u_norm = self.uri
+ if u_norm.startswith("/"):
+ u_norm = u_norm[1:]
+ u_norm = os.path.normpath(u_norm)
+ if u_norm.startswith(".."):
+ raise exceptions.TemplateLookupException(
+ "Template uri \"%s\" is invalid - "
+ "it cannot be relative outside "
+ "of the root path." % self.uri)
+
self.input_encoding = input_encoding
self.output_encoding = output_encoding
self.encoding_errors = encoding_errors
@@ -300,16 +310,6 @@ class Template(object):
if module_filename is not None:
path = module_filename
elif module_directory is not None:
- u_norm = self.uri
- if u_norm.startswith("/"):
- u_norm = u_norm[1:]
- u_norm = os.path.normpath(u_norm)
- if u_norm.startswith(".."):
- raise exceptions.TemplateLookupException(
- "Template uri \"%s\" is invalid - "
- "it cannot be relative outside "
- "of the root path." % self.uri)
-
path = os.path.abspath(
os.path.join(
os.path.normpath(module_directory),