Skip to content
Myr

Fixed a small bug with the undefined object: the error message on divisions with undefined objects was misleading.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 1c56b39 · Browse files · 2 files+5 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−4 removed

  • other:+5 added−4 removed

2 files+5 added−4 removed

modified:jinja2/runtime.py+3 added-2 removed
401 unmodified lines
402 hint = self._undefined_hint403 raise self._undefined_exception(hint)404405 __add__ = __radd__ = __mul__ = __rmul__ = __div__ = __rdiv__ = \406 __realdiv__ = __rrealdiv__ = __floordiv__ = __rfloordiv__ = \406 __truediv__ = __rtruediv__ = __floordiv__ = __rfloordiv__ = \407 __mod__ = __rmod__ = __pos__ = __neg__ = __call__ = \408 __getattr__ = __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = \409 __int__ = __float__ = __complex__ = _fail_with_undefined_error409 __int__ = __float__ = __complex__ = __pow__ = __rpow__ = \410 _fail_with_undefined_error411412 def __str__(self):413 return unicode(self).encode('utf-8')414
70 unmodified lines
modified:jinja2/sandbox.py+2 added-2 removed
210 unmodified lines
211 try:212 value = getattr(obj, attribute)213 except AttributeError:214 try:215 return obj[argument]215 return obj[attribute]216 except (TypeError, LookupError):217 pass218 else:219 if self.is_safe_attribute(obj, attribute, value):220 return value221 return self.unsafe_undefined(obj, attribute)222 return self.undefined(obj=obj, name=argument)222 return self.undefined(obj=obj, name=attribute)223224 def unsafe_undefined(self, obj, attribute):225 """Return an undefined object for unsafe attributes."""226 return self.undefined('access to attribute %r of %r '
24 unmodified lines