fixed some NameErrors
authorBenjamin Wiegand <highwaychile@bluevaria.de>
Mon, 28 Apr 2008 16:07:52 +0000 (18:07 +0200)
committerBenjamin Wiegand <highwaychile@bluevaria.de>
Mon, 28 Apr 2008 16:07:52 +0000 (18:07 +0200)
--HG--
branch : trunk

jinja2/exceptions.py
jinja2/ext.py
jinja2/filters.py
jinja2/nodes.py
jinja2/parser.py
jinja2/utils.py

index 0bbe33e0d04f34c5112201d62b30b6dc2d7c8d9c..b0853c4f60284e496ae9ee2436d25319282088be 100644 (file)
@@ -45,3 +45,9 @@ class TemplateAssertionError(TemplateSyntaxError):
 
 class TemplateRuntimeError(TemplateError):
     """A runtime error."""
+
+
+class FilterArgumentError(Exception):
+    """This error is raised if a filter was called with inappropriate
+    arguments
+    """
index 5ae317d0ea1fe3674ff5e939b7640c98ffce1326..1158505dc8eb048ffcf6b3154663fd766722d5fe 100644 (file)
@@ -15,7 +15,7 @@ from jinja2 import nodes
 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
 
 
index 4c9766c9754b1e52157b7b8cd0534b16758cdafb..0b55760169ef60683e17bd9f4c406c64448d2b4e 100644 (file)
@@ -19,6 +19,7 @@ from urllib import urlencode, quote
 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'(<!--.*?-->|<[^>]*>)')
index f87bbb8fc906d822efcd98f245e7a7329dcec86d..c1231ea9c561b11a5250217889c8827749b5f402 100644 (file)
@@ -504,7 +504,8 @@ class Subscript(Expr):
         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()
 
index 8bc1307d3d3b048c662f04e7158e7472c4361595..f225ab31fce41f3216a657202c69bace91ee908d 100644 (file)
@@ -535,7 +535,7 @@ class Parser(object):
             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)
index 639cda6e87631c6a9b81e07c010e3597465a5212..0704bb451c3154ad8d70cb51be033fe368602aff 100644 (file)
@@ -412,7 +412,7 @@ try:
     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