From: Armin Ronacher Date: Tue, 20 Apr 2010 11:45:11 +0000 (+0200) Subject: fixed an error reporting bug for undefineds. X-Git-Tag: 2.4.1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=800ac7f623a21e7549c7afd6aa7c340c0713eb3f;p=jinja2.git fixed an error reporting bug for undefineds. --HG-- branch : trunk --- diff --git a/CHANGES b/CHANGES index e4a5718..4f25898 100644 --- a/CHANGES +++ b/CHANGES @@ -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 ----------- diff --git a/jinja2/testsuite/utils.py b/jinja2/testsuite/utils.py index 25dde8b..a402bbc 100644 --- a/jinja2/testsuite/utils.py +++ b/jinja2/testsuite/utils.py @@ -18,7 +18,7 @@ from jinja2.testsuite import JinjaTestCase 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 @@ class LRUCacheTestCase(JinjaTestCase): 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 @@ class MarkupLeakTestCase(JinjaTestCase): 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'): diff --git a/jinja2/utils.py b/jinja2/utils.py index 0ba86e7..8bf2c7f 100644 --- a/jinja2/utils.py +++ b/jinja2/utils.py @@ -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 diff --git a/setup.py b/setup.py index 4235152..529d385 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ if sys.version_info >= (3, 0): setup( name='Jinja2', - version='2.4', + version='2.4.1', url='http://jinja.pocoo.org/', license='BSD', author='Armin Ronacher',