diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2019-07-08 16:36:03 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-07-08 16:36:03 +0000 |
commit | 4663af342bf76a736df36a3ca96e7f974d0e2fef (patch) | |
tree | 971b2f4d3ccf3d2f7dac6235186fb72e4ea3f191 /mako/template.py | |
parent | c0697963498a934a6323b8e04adf1a92aad25620 (diff) | |
parent | 65f8a3b715e8519ca5ca5d835240fe45aa4b96fa (diff) | |
download | external_python_mako-4663af342bf76a736df36a3ca96e7f974d0e2fef.tar.gz external_python_mako-4663af342bf76a736df36a3ca96e7f974d0e2fef.tar.bz2 external_python_mako-4663af342bf76a736df36a3ca96e7f974d0e2fef.zip |
Merge "Include URI in traceback if filename is unknown"
Diffstat (limited to 'mako/template.py')
-rw-r--r-- | mako/template.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mako/template.py b/mako/template.py index 2cd1ef4..8e87d50 100644 --- a/mako/template.py +++ b/mako/template.py @@ -330,7 +330,7 @@ class Template(object): (code, module) = _compile_text(self, text, filename) self._code = code self._source = text - ModuleInfo(module, None, self, filename, code, text) + ModuleInfo(module, None, self, filename, code, text, uri) elif filename is not None: # if template filename and a module directory, load # a filesystem-based module file, generating if needed @@ -421,7 +421,7 @@ class Template(object): ) module = compat.load_module(self.module_id, path) del sys.modules[self.module_id] - ModuleInfo(module, path, self, filename, None, None) + ModuleInfo(module, path, self, filename, None, None, None) else: # template filename and no module directory, compile code # in memory @@ -429,7 +429,7 @@ class Template(object): code, module = _compile_text(self, data, filename) self._source = None self._code = code - ModuleInfo(module, None, self, filename, code, None) + ModuleInfo(module, None, self, filename, code, None, None) return module @property @@ -584,6 +584,7 @@ class ModuleTemplate(Template): template_filename, module_source, template_source, + module._template_uri, ) self.callable_ = self.module.render_body @@ -641,12 +642,14 @@ class ModuleInfo(object): template_filename, module_source, template_source, + template_uri, ): self.module = module self.module_filename = module_filename self.template_filename = template_filename self.module_source = module_source self.template_source = template_source + self.template_uri = template_uri self._modules[module.__name__] = template._mmarker = self if module_filename: self._modules[module_filename] = self |