Skip to content

Commit

Permalink
fixed an error reporting bug for undefineds.
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
mitsuhiko committed Apr 20, 2010
1 parent 27387aa commit 800ac7f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
8 changes: 5 additions & 3 deletions 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
-----------
Expand Down
16 changes: 15 additions & 1 deletion jinja2/testsuite/utils.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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'):
Expand Down
4 changes: 2 additions & 2 deletions jinja2/utils.py
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -55,7 +55,7 @@

setup(
name='Jinja2',
version='2.4',
version='2.4.1',
url='http://jinja.pocoo.org/',
license='BSD',
author='Armin Ronacher',
Expand Down

0 comments on commit 800ac7f

Please sign in to comment.