Permalink
Browse files

fixed an error reporting bug for undefineds.

--HG--
branch : trunk
  • Loading branch information...
mitsuhiko committed Apr 20, 2010
1 parent 27387aa commit 800ac7f623a21e7549c7afd6aa7c340c0713eb3f
Showing with 23 additions and 7 deletions.
  1. +5 −3 CHANGES
  2. +15 −1 jinja2/testsuite/utils.py
  3. +2 −2 jinja2/utils.py
  4. +1 −1 setup.py
View
@@ -1,9 +1,11 @@
Jinja2 Changelog
================
-Version 2.5
------------
-(codename to be selected, release date to be announced)
+Version 2.4.1
+-------------
+(bugfix release, released on April 20th 2010)
+
+- fixed an error reporting bug for undefineds.
Version 2.4
-----------
View
@@ -18,7 +18,7 @@
from jinja2 import Environment, Undefined, DebugUndefined, \
StrictUndefined, UndefinedError, Template, meta
-from jinja2.utils import LRUCache, escape
+from jinja2.utils import LRUCache, escape, object_type_repr
class LRUCacheTestCase(JinjaTestCase):
@@ -46,6 +46,19 @@ def test_pickleable(self):
assert copy._queue == cache._queue
+class HelpersTestCase(JinjaTestCase):
+
+ def test_object_type_repr(self):
+ class X(object):
+ pass
+ self.assert_equal(object_type_repr(42), 'int object')
+ self.assert_equal(object_type_repr([]), 'list object')
+ self.assert_equal(object_type_repr(X()),
+ 'jinja2.testsuite.utils.X object')
+ self.assert_equal(object_type_repr(None), 'None')
+ self.assert_equal(object_type_repr(Ellipsis), 'Ellipsis')
+
+
class MarkupLeakTestCase(JinjaTestCase):
def test_markup_leaks(self):
@@ -63,6 +76,7 @@ def test_markup_leaks(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(LRUCacheTestCase))
+ suite.addTest(unittest.makeSuite(HelpersTestCase))
# this test only tests the c extension
if not hasattr(escape, 'func_code'):
View
@@ -237,9 +237,9 @@ def object_type_repr(obj):
elif obj is Ellipsis:
return 'Ellipsis'
if obj.__class__.__module__ == '__builtin__':
- name = obj.__name__
+ name = obj.__class__.__name__
else:
- name = obj.__class__.module__ + '.' + obj.__name__
+ name = obj.__class__.__module__ + '.' + obj.__class__.__name__
return '%s object' % name
View
@@ -55,7 +55,7 @@
setup(
name='Jinja2',
- version='2.4',
+ version='2.4.1',
url='http://jinja.pocoo.org/',
license='BSD',
author='Armin Ronacher',

0 comments on commit 800ac7f

Please sign in to comment.