diff options
| author | Blaise Laflamme <blaise@laflamme.org> | 2012-06-29 16:46:03 -0400 |
|---|---|---|
| committer | Blaise Laflamme <blaise@laflamme.org> | 2012-06-29 16:46:03 -0400 |
| commit | d4147eb8dc4962fa86863c77fc190717113994a7 (patch) | |
| tree | 567a6d5909bdb4f319a62f787853191174378bb7 | |
| parent | 71b473705f73b12a35422d3aa257906e4a99d853 (diff) | |
| download | pyramid-d4147eb8dc4962fa86863c77fc190717113994a7.tar.gz pyramid-d4147eb8dc4962fa86863c77fc190717113994a7.tar.bz2 pyramid-d4147eb8dc4962fa86863c77fc190717113994a7.zip | |
fixed mako bug #606 for inheritance and includes
| -rw-r--r-- | pyramid/mako_templating.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index bb4ccb2f0..9aeaa9153 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -42,12 +42,14 @@ class PkgResourceTemplateLookup(TemplateLookup): def get_template(self, uri): """Fetch a template from the cache, or check the filesystem for it - + In addition to the basic filesystem lookup, this subclass will use pkg_resource to load a file using the asset specification syntax. - + """ + if '$' in uri: + uri = uri.replace('$', ':') isabs = os.path.isabs(uri) if (not isabs) and (':' in uri): # Windows can't cope with colons in filenames, so we replace the @@ -70,7 +72,7 @@ class PkgResourceTemplateLookup(TemplateLookup): return TemplateLookup.get_template(self, uri) -registry_lock = threading.Lock() +registry_lock = threading.Lock() class MakoRendererFactoryHelper(object): def __init__(self, settings_prefix=None): @@ -143,7 +145,7 @@ class MakoRendererFactoryHelper(object): registry_lock.acquire() try: - registry.registerUtility(lookup, IMakoLookup, + registry.registerUtility(lookup, IMakoLookup, name=settings_prefix) finally: registry_lock.release() @@ -166,15 +168,15 @@ class MakoLookupTemplateRenderer(object): """ Render a :term:`Mako` template using the template implied by the ``path`` argument.The ``path`` argument may be a package-relative path, an absolute path, or a :term:`asset - specification`. If a defname is defined, in the form of - package:path/to/template#defname.mako, a function named ``defname`` + specification`. If a defname is defined, in the form of + package:path/to/template#defname.mako, a function named ``defname`` inside the template will then be rendered. """ def __init__(self, path, defname, lookup): self.path = path self.defname = defname self.lookup = lookup - + def implementation(self): return self.lookup.get_template(self.path) |
