Skip to content
Myr

[svn] documented debug.foobar and added it to the CHANGES

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 a38b312 · Browse files · 3 files+35 added−0 removed
This commit

State

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

Diff stats

3 files+35 added−0 removed

  • other:+35 added−0 removed

3 files+35 added−0 removed

modified:docs/src/designerdoc.txt+14 added
130 unmodified lines
131These tests are especially useful when used in `if` conditions.132133[[list_of_tests]]134135*new in Jinja 1.1*:136137Because the application can provide additional tests you can get a documentation138of all the provided tests by calling ``debug.tests()``:139140.. sourcecode:: jinja141142 {{ debug.tests() }}143 -> returns a plain text representation of all the tests144145 {{ debug.tests(False) }}146 -> same as above but without the builtin ones.147148149Global Functions150================151152Test functions and filter functions live in their own namespace. Global
774 unmodified lines
modified:jinja/utils.py+18 added
398 unmodified lines
399 result.append('`%s`\n\n%s' % (name, doc))400 return '\n\n'.join(result)401 filters.jinja_context_callable = True402403 def tests(self, env, context, builtins=True):404 """List the tests."""405 from inspect import getdoc406 strip = set()407 if not builtins:408 from jinja.defaults import DEFAULT_TESTS409 strip = set(DEFAULT_TESTS.values())410 tests = env.tests.items()411 tests.sort(lambda a, b: cmp(a[0].lower(), b[0].lower()))412 result = []413 for name, f in tests:414 if f in strip:415 continue416 doc = '\n'.join(' ' + x for x in (getdoc(f) or '').splitlines())417 result.append('`%s`\n\n%s' % (name, doc))418 return '\n\n'.join(result)419 tests.jinja_context_callable = True420421 def __str__(self):422 print 'use debug() for debugging the context'423424
224 unmodified lines
modified:CHANGES+3 added
8 unmodified lines
910- debugging system improved, smaller filesize for the cached files.11 Debugging works now well for any module using linecache.1213- ``{{ debug() }}`` can now be used to get a list of filters and14 tags.1516- added whitespace management system for the template designer.1718- some small bugfixes.19
35 unmodified lines