Skip to content
Myr

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

6 files+22 added−10 removed

modified:tests/test_ext.py+5 added-4 removed
13 unmodified lines
1415importable_object = 23161718_gettext_re = re.compile(r'_\((.*?)\)')18_gettext_re = re.compile(r'_\((.*?)\)(?s)')192021class TestExtension(Extension):22 tags = set(['test'])
25 unmodified lines
48class StreamFilterExtension(Extension):4950 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 token
74 unmodified lines
131132133def 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'139140141class WithExtension(Extension):142 tags = frozenset(['with'])
19 unmodified lines
modified:tests/test_filters.py+4 added-4 removed
87 unmodified lines
888990def 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)]")969798def test_batch():99 tmpl = env.from_string(BATCH)
229 unmodified lines
modified:tests/test_various.py+4 added
9 unmodified lines
10from jinja2 import escape, is_undefined, Environment11from jinja2.utils import Cycler12from jinja2.exceptions import TemplateSyntaxError1314from nose import SkipTest15from nose.tools import assert_raises1617env = Environment()18
34 unmodified lines
53 assert tmpl.render() == '0'545556def 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 lines
modified:.hgignore+2 added-1 removed
2 unmodified lines
3^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
1Jinja2 Changelog2================34Version 2.2.15-------------6(bugfix release, released on September 14th 2009)78- fixes some smaller problems for Jinja2 on Jython.910Version 2.211-----------12(codename Kong, released on September 13th 2009)13
107 unmodified lines
modified:setup.py+1 added-1 removed
47 unmodified lines
484950setup(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