Fixed a small bug with the undefined object: the error message on divisions with...
authorArmin Ronacher <armin.ronacher@active-4.com>
Sun, 2 Nov 2008 11:22:00 +0000 (12:22 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sun, 2 Nov 2008 11:22:00 +0000 (12:22 +0100)
--HG--
branch : trunk

jinja2/runtime.py
jinja2/sandbox.py

index 815b5892e06f86f75e1b843ce0e61f190574502c..2ed3ac64651c860462dbe82f8cf4907c21dd45ad 100644 (file)
@@ -403,10 +403,11 @@ class Undefined(object):
         raise self._undefined_exception(hint)
 
     __add__ = __radd__ = __mul__ = __rmul__ = __div__ = __rdiv__ = \
-    __realdiv__ = __rrealdiv__ = __floordiv__ = __rfloordiv__ = \
+    __truediv__ = __rtruediv__ = __floordiv__ = __rfloordiv__ = \
     __mod__ = __rmod__ = __pos__ = __neg__ = __call__ = \
     __getattr__ = __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = \
-    __int__ = __float__ = __complex__ = _fail_with_undefined_error
+    __int__ = __float__ = __complex__ = __pow__ = __rpow__ = \
+        _fail_with_undefined_error
 
     def __str__(self):
         return unicode(self).encode('utf-8')
index e9ab1d9165b270e5955abea65e33a1b000f8c88a..7b28273df70dc9f8b9cc6906c4ab4ea3b4213741 100644 (file)
@@ -212,14 +212,14 @@ class SandboxedEnvironment(Environment):
             value = getattr(obj, attribute)
         except AttributeError:
             try:
-                return obj[argument]
+                return obj[attribute]
             except (TypeError, LookupError):
                 pass
         else:
             if self.is_safe_attribute(obj, attribute, value):
                 return value
             return self.unsafe_undefined(obj, attribute)
-        return self.undefined(obj=obj, name=argument)
+        return self.undefined(obj=obj, name=attribute)
 
     def unsafe_undefined(self, obj, attribute):
         """Return an undefined object for unsafe attributes."""