fixes some smaller problems for Jinja2 on Jython.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
--HG-- branch : trunk
authored by Armin Ronacher · committed by Armin Ronacher · parent e7c72bc · Browse files · 6 files·+22 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+22 added−10 removed
- tests:+13 added−8 removed
- other:+9 added−2 removed
Provenance
- Commit
9e6400e- Tree
e7ae36a- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
e7c72bc
6 files changed+22 added−10 removed
modified:tests/test_ext.py+5 added-4 removed
13 unmodified lines14 15 importable_object = 2316 17 18-_gettext_re = re.compile(r'_\((.*?)\)')18+_gettext_re = re.compile(r'_\((.*?)\)(?s)')19 20 21 class TestExtension(Extension):22 tags = set(['test'])25 unmodified lines48 class StreamFilterExtension(Extension):49 50 def filter_stream(self, stream):51 for token in stream:52- if token.type is 'data':52+ if token.type == 'data':53 for t in self.interpolate(token):54 yield t55 else:56 yield token74 unmodified lines131 132 133 def test_streamfilter_extension():134 env = Environment(extensions=[StreamFilterExtension])135- env.globals['gettext'] = lambda x: x.title()135+ env.globals['gettext'] = lambda x: x.upper()136 tmpl = env.from_string('Foo _(bar) Baz')137- assert tmpl.render() == 'Foo Bar Baz'137+ out = tmpl.render()138+ assert out == 'Foo BAR Baz'139 140 141 class WithExtension(Extension):142 tags = frozenset(['with'])19 unmodified linesmodified:tests/test_filters.py+4 added-4 removed
87 unmodified lines88 89 90 def test_dictsort():91 tmpl = env.from_string(DICTSORT)92- out = tmpl.render(foo={"a": 0, "b": 1, "c": 2, "A": 3})93- assert out == ("[('a', 0), ('A', 3), ('b', 1), ('c', 2)]|"94- "[('A', 3), ('a', 0), ('b', 1), ('c', 2)]|"95- "[('a', 0), ('b', 1), ('c', 2), ('A', 3)]")92+ out = tmpl.render(foo={"aa": 0, "b": 1, "c": 2, "AB": 3})93+ assert out == ("[('aa', 0), ('AB', 3), ('b', 1), ('c', 2)]|"94+ "[('AB', 3), ('aa', 0), ('b', 1), ('c', 2)]|"95+ "[('aa', 0), ('b', 1), ('c', 2), ('AB', 3)]")96 97 98 def test_batch():99 tmpl = env.from_string(BATCH)229 unmodified linesmodified:tests/test_various.py+4 added
9 unmodified lines10 from jinja2 import escape, is_undefined, Environment11 from jinja2.utils import Cycler12 from jinja2.exceptions import TemplateSyntaxError13 14+from nose import SkipTest15 from nose.tools import assert_raises16 17 env = Environment()18 34 unmodified lines53 assert tmpl.render() == '0'54 55 56 def test_markup_leaks():57+ # this test only tests the c extension58+ if hasattr(escape, 'func_code'):59+ raise SkipTest()60 counts = set()61 for count in xrange(20):62 for item in xrange(1000):63 escape("foo")52 unmodified linesmodified:.hgignore+2 added-1 removed
2 unmodified lines3 ^jinja2/.*\.so$4 ^docs/_build5 ^(build|dist|Jinja2\.egg-info)/6 \.py[co]$7+\$py\.class$8 \.DS_Store$8-^env/9+^j?env/10 ^py3k/modified:CHANGES+6 added
1 Jinja2 Changelog2 ================3 4+Version 2.2.15+-------------6+(bugfix release, released on September 14th 2009)7+8+- fixes some smaller problems for Jinja2 on Jython.9+10 Version 2.211 -----------12 (codename Kong, released on September 13th 2009)13 107 unmodified linesmodified:setup.py+1 added-1 removed
47 unmodified lines48 49 50 setup(51 name='Jinja2',52- version='2.3',52+ version='2.2.1',53 url='http://jinja.pocoo.org/',54 license='BSD',55 author='Armin Ronacher',56 author_email='armin.ronacher@active-4.com',31 unmodified lines