Home | History | Annotate | Download | only in jinja2

Lines Matching refs:template

36 # for direct template usage we have up to ten living environments
107 they are not shared and if no template was loaded so far.
108 Modifications on environments after the first template was loaded
160 if present, to be stripped from the end of the template.
174 undefined values in the template.
185 be a callable that is passed the template name and has to
193 The template loader for this environment.
198 out the least recently used template. If the cache size is set to
203 Some loaders load templates from locations where the template
205 `auto_reload` is set to `True` (default) every time a template is
207 will reload the template. For higher performance it's possible to
265 # - spontaneous environments (i18n extension and Template)
444 tree of nodes is used by the compiler to convert the template into
517 """Compile a node or template source code. The `name` parameter is
518 the load name of the template after it was joined using
520 the `filename` parameter is the estimated filename of the template on
521 the file system. If the template came from a database or memory this
548 filename = '<template>'
562 in template "configuration files" or similar situations.
598 template = self.from_string(nodes.Template(body, lineno=1))
599 return TemplateExpression(template, undefined_to_none)
611 Each template returned will be compiled to the target folder or
614 By default template compilation errors are ignored. In case a
615 log function is provided, errors are logged. If you want template
700 If there are other files in the template folder besides the
704 is passed a template name and should return `True` if it should end up
724 rewritten exceptions or return a rendered traceback for the template.
732 # get any exceptions in template rendering there is no need to load
744 def join_path(self, template, parent):
745 """Join a template with the parent. By default all the lookups are
746 relative to the loader root so this method returns the `template`
748 parent template, this function can be used to calculate the real
749 template name.
751 Subclasses may override this method and implement template path
754 return template
761 template = self.cache.get(name)
762 if template is not None and (not self.auto_reload or \
763 template.is_up_to_date):
764 return template
765 template = self.loader.load(self, name, globals)
767 self.cache[name] = template
768 return template
772 """Load a template from the loader. If a loader is configured this
773 method ask the loader for the template and returns a :class:`Template`.
775 to get the real template name before loading.
777 The `globals` parameter can be used to provide template wide globals.
780 If the template does not exist a :exc:`TemplateNotFound` exception is
784 If `name` is a :class:`Template` object it is returned from the
787 if isinstance(name, Template):
802 If `names` contains a :class:`Template` object it is returned
810 if isinstance(name, Template):
824 if an iterable of template names is given, otherwise to
831 elif isinstance(template_name_or_list, Template):
836 """Load a template from a string. This parses the source given and
837 returns a :class:`Template` object.
850 class Template(object):
851 """The central template object. This class represents a compiled template
854 Normally the template object is generated from an :class:`Environment` but
855 it also has a constructor that makes it possible to create a template
859 Every template object has a few methods and members that are guaranteed
860 to exist. However it's important that a template object should be
863 Template objects created from the constructor rather than an environment
868 >>> template = Template('Hello {{ name }}!')
869 >>> template.render(name='John Doe')
872 >>> stream = template.stream(name='John Doe')
910 """Creates a template object from compiled code and the globals. This
911 is used by the loaders and environment to create a template object.
924 """Creates a template object from a module. This is used by the
925 module loader to create a template object.
959 template.render(knights='that say nih')
960 template.render({'knights': 'that say nih'})
962 This will return the rendered template as unicode string.
979 template at once but evaluate each statement after another and yield
996 """Create a new :class:`Context` for this template. The vars
997 provided will be passed to the template. Per default the globals
1008 without arguments but it will evaluate the template on every call
1017 """The template as module. This is used for imports in the
1018 template runtime but is also useful if one wants to access
1019 exported template variables from the Python layer:
1021 >>> t = Template('{% macro foo() %}42{% endmacro %}23')
1064 """Represents an imported template. All the exported names of the
1065 template are available as attributes on this object. Additionally
1069 def __init__(self, template, context):
1070 self._body_stream = list(template.root_render_func(context))
1072 self.__name__ = template.name
1091 to the template with an expression it wraps.
1094 def __init__(self, template, undefined_to_none):
1095 self._template = template
1109 """A template stream works pretty much like an ordinary python generator
1112 instruction in the template one unicode string is yielded.
1130 Template('Hello {{ name }}!').stream(name='foo').dump('hello.html')
1189 # hook in default template class. if anyone reads this comment: ignore that
1191 Environment.template_class = Template