From: Armin Ronacher Date: Mon, 14 Sep 2009 21:58:01 +0000 (-0700) Subject: fixes some smaller problems for Jinja2 on Jython. X-Git-Tag: 2.2.1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e6400e513c8795116e780f58709ffa65b2dc975;p=jinja2.git fixes some smaller problems for Jinja2 on Jython. --HG-- branch : trunk --- diff --git a/.hgignore b/.hgignore index 7a1b935..d5acae4 100644 --- a/.hgignore +++ b/.hgignore @@ -4,6 +4,7 @@ ^docs/_build ^(build|dist|Jinja2\.egg-info)/ \.py[co]$ +\$py\.class$ \.DS_Store$ -^env/ +^j?env/ ^py3k/ diff --git a/CHANGES b/CHANGES index 05d28d7..65a37b0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ Jinja2 Changelog ================ +Version 2.2.1 +------------- +(bugfix release, released on September 14th 2009) + +- fixes some smaller problems for Jinja2 on Jython. + Version 2.2 ----------- (codename Kong, released on September 13th 2009) diff --git a/setup.py b/setup.py index 09998a4..bcdc5dd 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ from distutils.errors import CCompilerError, DistutilsPlatformError setup( name='Jinja2', - version='2.3', + version='2.2.1', url='http://jinja.pocoo.org/', license='BSD', author='Armin Ronacher', diff --git a/tests/test_ext.py b/tests/test_ext.py index ed2c683..a12ca33 100644 --- a/tests/test_ext.py +++ b/tests/test_ext.py @@ -15,7 +15,7 @@ from jinja2.lexer import Token, count_newlines importable_object = 23 -_gettext_re = re.compile(r'_\((.*?)\)') +_gettext_re = re.compile(r'_\((.*?)\)(?s)') class TestExtension(Extension): @@ -49,7 +49,7 @@ class StreamFilterExtension(Extension): def filter_stream(self, stream): for token in stream: - if token.type is 'data': + if token.type == 'data': for t in self.interpolate(token): yield t else: @@ -132,9 +132,10 @@ def test_preprocessor_extension(): def test_streamfilter_extension(): env = Environment(extensions=[StreamFilterExtension]) - env.globals['gettext'] = lambda x: x.title() + env.globals['gettext'] = lambda x: x.upper() tmpl = env.from_string('Foo _(bar) Baz') - assert tmpl.render() == 'Foo Bar Baz' + out = tmpl.render() + assert out == 'Foo BAR Baz' class WithExtension(Extension): diff --git a/tests/test_filters.py b/tests/test_filters.py index 19902ff..5741693 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -89,10 +89,10 @@ def test_default(): def test_dictsort(): tmpl = env.from_string(DICTSORT) - out = tmpl.render(foo={"a": 0, "b": 1, "c": 2, "A": 3}) - assert out == ("[('a', 0), ('A', 3), ('b', 1), ('c', 2)]|" - "[('A', 3), ('a', 0), ('b', 1), ('c', 2)]|" - "[('a', 0), ('b', 1), ('c', 2), ('A', 3)]") + out = tmpl.render(foo={"aa": 0, "b": 1, "c": 2, "AB": 3}) + assert out == ("[('aa', 0), ('AB', 3), ('b', 1), ('c', 2)]|" + "[('AB', 3), ('aa', 0), ('b', 1), ('c', 2)]|" + "[('aa', 0), ('b', 1), ('c', 2), ('AB', 3)]") def test_batch(): diff --git a/tests/test_various.py b/tests/test_various.py index 92ac6b8..942c1c3 100644 --- a/tests/test_various.py +++ b/tests/test_various.py @@ -11,6 +11,7 @@ from jinja2 import escape, is_undefined, Environment from jinja2.utils import Cycler from jinja2.exceptions import TemplateSyntaxError +from nose import SkipTest from nose.tools import assert_raises env = Environment() @@ -53,6 +54,9 @@ def test_localset(): def test_markup_leaks(): + # this test only tests the c extension + if hasattr(escape, 'func_code'): + raise SkipTest() counts = set() for count in xrange(20): for item in xrange(1000):