Skip to content
Myr

Merge branch 'master' into sprint-branch

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parents 0c435cc, 9962c10 · Browse files · 4 files+26 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+26 added−2 removed

  • other:+26 added−2 removed

4 files+26 added−2 removed

modified:docs/tricks.rst+1 added-1 removed
73 unmodified lines
74 ...75 <ul id="navigation">76 {% for href, id, caption in navigation_bar %}77 <li{% if id == active_page %} class="active"{% endif78 %}><a href="{{ href|e }}">{{ caption|e }}</a>/li>78 %}><a href="{{ href|e }}">{{ caption|e }}</a></li>79 {% endfor %}80 </ul>81 ...82
18 unmodified lines
modified:jinja2/testsuite/regression.py+13 added-1 removed
245 unmodified lines
246 except TemplateNotFound as e:247 assert e.name == 'foo/bar.html'248 else:249 assert False, 'expected error here'250 251 def test_contextfunction_callable_classes(self):252 from jinja2.utils import contextfunction253 class CallableClass(object):254 @contextfunction255 def __call__(self, ctx):256 return ctx.resolve('hello')257 258 tpl = Template("""{{ callableclass() }}""")259 output = tpl.render(callableclass = CallableClass(), hello = 'TEST')260 expected = 'TEST'261 262 self.assert_equal(output, expected)263251264def suite():265 suite = unittest.TestSuite()266 suite.addTest(unittest.makeSuite(CornerTestCase))267 suite.addTest(unittest.makeSuite(BugTestCase))
1 unmodified line
modified:jinja2/runtime.py+11 added
174 unmodified lines
175 :func:`environmentfunction`.176 """177 if __debug__:178 __traceback_hide__ = True179180 # Allow callable classes to take a context181 if hasattr(__obj, '__call__'):182 fn = __obj.__call__183 for fn_type in ('contextfunction',184 'evalcontextfunction',185 'environmentfunction'):186 if hasattr(fn, fn_type):187 __obj = fn188 break189190 if isinstance(__obj, _context_function_types):191 if getattr(__obj, 'contextfunction', 0):192 args = (__self,) + args193 elif getattr(__obj, 'evalcontextfunction', 0):
385 unmodified lines
modified:CHANGES+1 added
15 unmodified lines
16- Accessing `last` on the loop context no longer causes the iterator17 to be consumed into a list.18- Python requirement changed: 2.6, 2.7 or >= 3.3 are required now,19 supported by same source code, using the "six" compatibility library.20- Allow `contextfunction` and other decorators to be applied to `__call__`.2122Version 2.623-----------24(codename Convolution, released on July 24th 2011)
263 unmodified lines