class TemplateRuntimeError(TemplateError):
"""A runtime error."""
+
+
+class FilterArgumentError(Exception):
+ """This error is raised if a filter was called with inappropriate
+ arguments
+ """
from jinja2.environment import get_spontaneous_environment
from jinja2.runtime import Undefined, concat
from jinja2.parser import statement_end_tokens
-from jinja2.exceptions import TemplateAssertionError
+from jinja2.exceptions import TemplateAssertionError, TemplateSyntaxError
from jinja2.utils import import_string, Markup
from itertools import imap, groupby
from jinja2.utils import Markup, escape, pformat, urlize, soft_unicode
from jinja2.runtime import Undefined
+from jinja2.exceptions import FilterArgumentError
_striptags_re = re.compile(r'(<!--.*?-->|<[^>]*>)')
if self.ctx != 'load':
raise Impossible()
try:
- return environmen.subscribe(self.node.as_const(), self.arg.as_const())
+ return self.environment.subscribe(self.node.as_const(),
+ self.arg.as_const())
except:
raise Impossible()
if len(args) == 1:
arg = args[0]
else:
- arg = nodes.Tuple(args, lineno, self.filename)
+ arg = nodes.Tuple(args, self.lineno, self.filename)
else:
raise TemplateSyntaxError('expected subscript expression',
self.lineno, self.filename)
from functools import partial
except ImportError:
class partial(object):
- def __init__(self, _func, *args, **kwargs):
+ def __init__(self, func, *args, **kwargs):
self._func = func
self._args = args
self._kwargs = kwargs