Skip to content

Commit

Permalink
fixes some smaller problems for Jinja2 on Jython.
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
mitsuhiko committed Sep 14, 2009
1 parent e7c72bc commit 9e6400e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .hgignore
Expand Up @@ -4,6 +4,7 @@
^docs/_build
^(build|dist|Jinja2\.egg-info)/
\.py[co]$
\$py\.class$
\.DS_Store$
^env/
^j?env/
^py3k/
6 changes: 6 additions & 0 deletions 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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -49,7 +49,7 @@

setup(
name='Jinja2',
version='2.3',
version='2.2.1',
url='http://jinja.pocoo.org/',
license='BSD',
author='Armin Ronacher',
Expand Down
9 changes: 5 additions & 4 deletions tests/test_ext.py
Expand Up @@ -15,7 +15,7 @@
importable_object = 23


_gettext_re = re.compile(r'_\((.*?)\)')
_gettext_re = re.compile(r'_\((.*?)\)(?s)')


class TestExtension(Extension):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_filters.py
Expand Up @@ -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():
Expand Down
4 changes: 4 additions & 0 deletions tests/test_various.py
Expand Up @@ -11,6 +11,7 @@
from jinja2.utils import Cycler
from jinja2.exceptions import TemplateSyntaxError

from nose import SkipTest
from nose.tools import assert_raises

env = Environment()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 9e6400e

Please sign in to comment.