Skip to content
Myr

[svn] added "renderinclude" function (highly experimental)

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 c1c1111 · Browse files · 2 files+14 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

2 files+14 added−2 removed

  • other:+14 added−2 removed

2 files+14 added−2 removed

modified:jinja/defaults.py+3 added-2 removed
9 unmodified lines
10"""11from jinja.filters import FILTERS as DEFAULT_FILTERS12from jinja.tests import TESTS as DEFAULT_TESTS13from jinja.utils import debug_helper, safe_range, generate_lorem_ipsum, \14 watch_changes14 watch_changes, render_included151617__all__ = ['DEFAULT_FILTERS', 'DEFAULT_TESTS', 'DEFAULT_NAMESPACE']18
1 unmodified line
20DEFAULT_NAMESPACE = {21 'range': safe_range,22 'debug': debug_helper,23 'lipsum': generate_lorem_ipsum,24 'watchchanges': watch_changes24 'watchchanges': watch_changes,25 'renderincluded': render_included26}
modified:jinja/utils.py+11 added
239 unmodified lines
240 yield changed, item241watch_changes.jinja_context_callable = True242243244def render_included(env, context, template_name):245 """246 Works like djangos {% include %} tag. It doesn't include the247 template but load it independently and renders it to a string.248 """249 #XXX: ignores parent completely!250 tmpl = env.get_template(template_name)251 return tmpl.render(context.to_dict())252render_included.jinja_context_callable = True253254255# python2.4 and lower has a bug regarding joining of broken generators.256# because of the runtime debugging system we have to keep track of the257# number of frames to skip. that's what RUNTIME_EXCEPTION_OFFSET is for.258try:
417 unmodified lines