Skip to content
Myr

added cache_clear function

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 aaf010d · Browse files · 5 files+21 added−4 removed
This commit

State

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

Diff stats

5 files+21 added−4 removed

  • other:+21 added−4 removed

5 files+21 added−4 removed

modified:docs/api.rst+2 added
209 unmodified lines
210 Use this if you need to display text that might contain such characters211 in HTML. This function will not escaped objects that do have an HTML212 representation such as already escaped data.213214.. autofunction:: jinja2.utils.clear_caches215216.. autoclass:: jinja2.utils.Markup217218219Exceptions
117 unmodified lines
modified:jinja2/__init__.py+3 added-2 removed
47 unmodified lines
48 TemplateNotFound, TemplateSyntaxError, TemplateAssertionError4950# decorators and public utilities51from jinja2.filters import environmentfilter, contextfilter52from jinja2.utils import Markup, escape, environmentfunction, contextfunction52from jinja2.utils import Markup, escape, clear_caches, \53 environmentfunction, contextfunction5455__all__ = [56 'Environment', 'Template', 'BaseLoader', 'FileSystemLoader',57 'PackageLoader', 'DictLoader', 'FunctionLoader', 'PrefixLoader',58 'ChoiceLoader', 'Undefined', 'DebugUndefined', 'StrictUndefined',59 'TemplateError', 'UndefinedError', 'TemplateNotFound',60 'TemplateSyntaxError', 'TemplateAssertionError', 'environmentfilter',61 'contextfilter', 'Markup', 'escape', 'environmentfunction',61 'contextfunction'62 'contextfunction', 'clear_caches'63]
modified:jinja2/debug.py+3 added-1 removed
1 unmodified line
2"""3 jinja2.debug4 ~~~~~~~~~~~~56 Implements the debug interface for Jinja.6 Implements the debug interface for Jinja. This module does some pretty7 ugly stuff with the Python traceback system in order to achieve tracebacks8 with correct line numbers, locals and contents.910 :copyright: Copyright 2008 by Armin Ronacher.11 :license: BSD.12"""
179 unmodified lines
modified:jinja2/lexer.py+1 added-1 removed
21 unmodified lines
222324# cache for the lexers. Exists in order to be able to have multiple25# environments with the same lexer26_lexer_cache = LRUCache(10)26_lexer_cache = LRUCache(50)2728# static regular expressions29whitespace_re = re.compile(r'\s+(?um)')30string_re = re.compile(r"('([^'\\]*(?:\\.[^'\\]*)*)'"
403 unmodified lines
modified:jinja2/utils.py+12 added
45 unmodified lines
46 f.environmentfunction = True47 return f484950def clear_caches():51 """Jinja2 keeps internal caches for environments and lexers. These are52 used so that Jinja2 doesn't have to recreate environments and lexers all53 the time. Normally you don't have to care about that but if you are54 messuring memory consumption you may want to clean the caches.55 """56 from jinja2.environment import _spontaneous_environments57 from jinja2.lexer import _lexer_cache58 _spontaneous_environments.clear()59 _lexer_cache.clear()606162def import_string(import_name, silent=False):63 """Imports an object based on a string. This use useful if you want to64 use import paths as endpoints or something similar. An import path can65 be specified either in dotted notation (``xml.sax.saxutils.escape``)
380 unmodified lines