Blaise Laflamme
2012-06-29 d4147eb8dc4962fa86863c77fc190717113994a7
fixed mako bug #606 for inheritance and includes
1 files modified
16 ■■■■■ changed files
pyramid/mako_templating.py 16 ●●●●● patch | view | raw | blame | history
pyramid/mako_templating.py
@@ -42,12 +42,14 @@
    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 @@
        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 @@
            registry_lock.acquire()
            try:
                registry.registerUtility(lookup, IMakoLookup,
                registry.registerUtility(lookup, IMakoLookup,
                                         name=settings_prefix)
            finally:
                registry_lock.release()
@@ -166,15 +168,15 @@
    """ 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)