How to use the mako.exceptions.TemplateLookupException function in Mako

To help you get started, we’ve selected a few Mako examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tp4a / teleport / server / www / packages / packages-linux / x64 / mako / runtime.py View on Github external
def _lookup_template(context, uri, relativeto):
    lookup = context._with_template.lookup
    if lookup is None:
        raise exceptions.TemplateLookupException(
            "Template '%s' has no TemplateLookup associated" %
            context._with_template.uri)
    uri = lookup.adjust_uri(uri, relativeto)
    try:
        return lookup.get_template(uri)
    except exceptions.TopLevelLookupException:
        raise exceptions.TemplateLookupException(str(compat.exception_as()))
github sqlalchemy / mako / mako / runtime.py View on Github external
def _lookup_template(context, uri, relativeto):
    lookup = context._with_template.lookup
    if lookup is None:
        raise exceptions.TemplateLookupException(
            "Template '%s' has no TemplateLookup associated"
            % context._with_template.uri
        )
    uri = lookup.adjust_uri(uri, relativeto)
    try:
        return lookup.get_template(uri)
    except exceptions.TopLevelLookupException:
        raise exceptions.TemplateLookupException(str(compat.exception_as()))
github cloudera / hue / desktop / core / ext-py / Mako-0.3.4 / mako / lookup.py View on Github external
def has_template(self, uri):
        try:
            self.get_template(uri)
            return True
        except exceptions.TemplateLookupException:
            return False
github cloudera / hue / desktop / core / ext-py / Mako-0.3.4 / mako / lookup.py View on Github external
def _check(self, uri, template):
        if template.filename is None:
            return template
        if not os.path.exists(template.filename):
            self._collection.pop(uri, None)
            raise exceptions.TemplateLookupException(
                                "Cant locate template for uri %r" % uri)
        elif template.module._modified_time < \
                        os.stat(template.filename)[stat.ST_MTIME]:
            self._collection.pop(uri, None)
            return self._load(template.filename, uri)
        else:
            return template
github sqlalchemy / mako / mako / lookup.py View on Github external
def _check(self, uri, template):
        if template.filename is None:
            return template

        try:
            template_stat = os.stat(template.filename)
            if template.module._modified_time < template_stat[stat.ST_MTIME]:
                self._collection.pop(uri, None)
                return self._load(template.filename, uri)
            else:
                return template
        except OSError:
            self._collection.pop(uri, None)
            raise exceptions.TemplateLookupException(
                "Cant locate template for uri %r" % uri
            )
github zzzeek / mako / mako / runtime.py View on Github external
def _lookup_template(context, uri, relativeto):
    lookup = context._with_template.lookup
    if lookup is None:
        raise exceptions.TemplateLookupException(
            "Template '%s' has no TemplateLookup associated"
            % context._with_template.uri
        )
    uri = lookup.adjust_uri(uri, relativeto)
    try:
        return lookup.get_template(uri)
    except exceptions.TopLevelLookupException:
        raise exceptions.TemplateLookupException(str(compat.exception_as()))
github tp4a / teleport / server / www / packages / packages-linux / x64 / mako / lookup.py View on Github external
def _check(self, uri, template):
        if template.filename is None:
            return template

        try:
            template_stat = os.stat(template.filename)
            if template.module._modified_time < \
                    template_stat[stat.ST_MTIME]:
                self._collection.pop(uri, None)
                return self._load(template.filename, uri)
            else:
                return template
        except OSError:
            self._collection.pop(uri, None)
            raise exceptions.TemplateLookupException(
                "Cant locate template for uri %r" % uri)