From 6b559994fe4006e8cc0d2135f1f4548a60ab8ff0 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 21 May 2013 19:16:34 -0400 Subject: override all known attrs and methods instead of allowing subclass to override in failure case --- pyramid/mako_templating.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index 69b48a3b5..31c398862 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -25,13 +25,17 @@ from pyramid.util import DottedNameResolver try: from mako.lookup import TemplateLookup except (ImportError, SyntaxError, AttributeError): #pragma NO COVER + def no_mako(*arg, **kw): + raise NotImplementedError( + "'mako' package is not importable (maybe downgrade MarkupSafe to " + "0.16 or below if you're using Python 3.2)" + ) class TemplateLookup(object): def __init__(self, **kw): - pass - def no_mako(self, *args, **kw): - raise NotImplementedError("'mako' not importable") - adjust_uri = get_template = filename_to_uri = no_mako - put_string = put_template = no_mako + for name in ('adjust_uri', 'get_template', 'filename_to_uri', + 'put_string', 'put_template'): + setattr(self, name, no_mako) + self.filesystem_checks = False try: from mako.exceptions import TopLevelLookupException -- cgit v1.2.3