fixes some smaller problems for Jinja2 on Jython.

--HG--
branch : trunk
This commit is contained in:
Armin Ronacher 2009-09-14 14:58:01 -07:00
parent e7c72bc235
commit 9e6400e513
6 changed files with 22 additions and 10 deletions

View File

@ -4,6 +4,7 @@
^docs/_build
^(build|dist|Jinja2\.egg-info)/
\.py[co]$
\$py\.class$
\.DS_Store$
^env/
^j?env/
^py3k/

View File

@ -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)

View File

@ -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',

View File

@ -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):

View File

@ -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():

View File

@ -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):