Home | History | Annotate | Download | only in jinja2

Lines Matching refs:template

22 def split_template_path(template):
27 for piece in template.split('/'):
31 raise TemplateNotFound(template)
41 :class:`Template` object.
54 def get_source(self, environment, template):
55 path = join(self.path, template)
57 raise TemplateNotFound(template)
70 def get_source(self, environment, template):
71 """Get the template source, filename and reload helper for a template.
72 It's passed the environment and template name and has to return a
74 `TemplateNotFound` error if it can't locate the template.
77 template as unicode string or a ASCII bytestring. The filename should
83 reloading is enabled it's always called to check if the template
86 the template will be reloaded.
91 raise TemplateNotFound(template)
101 """Loads a template. This method looks up the template in the cache
111 # first we try to get the source for this template together
123 # date) etc. we compile the template
149 Per default the template encoding is ``'utf-8'`` which can be changed
159 def get_source(self, environment, template):
160 pieces = split_template_path(template)
178 raise TemplateNotFound(template)
185 template = os.path.join(dirpath, filename) \
188 if template[:2] == './':
189 template = template[2:]
190 if template not in found:
191 found.add(template)
204 Per default the template encoding is ``'utf-8'`` which can be changed
221 def get_source(self, environment, template):
222 pieces = split_template_path(template)
225 raise TemplateNotFound(template)
261 """Loads a template from a python dict. It's passed a dict of unicode
262 strings bound to template names. This loader is useful for unittesting:
272 def get_source(self, environment, template):
273 if template in self.mapping:
274 source = self.mapping[template]
275 return source, None, lambda: source == self.mapping.get(template)
276 raise TemplateNotFound(template)
284 function becomes the name of the template passed and has to return either
285 an unicode string with the template source, a tuple in the form ``(source,
286 filename, uptodatefunc)`` or `None` if the template does not exist.
295 and has to return `True` if the template is still up to date. For more
303 def get_source(self, environment, template):
304 rv = self.load_func(template)
306 raise TemplateNotFound(template)
314 to a prefix. The prefix is delimited from the template by a slash per
331 def get_loader(self, template):
333 prefix, name = template.split(self.delimiter, 1)
336 raise TemplateNotFound(template)
339 def get_source(self, environment, template):
340 loader, name = self.get_loader(template)
346 raise TemplateNotFound(template)
361 for template in loader.list_templates():
362 result.append(prefix + self.delimiter + template)
368 specified. If a template could not be found by one loader the next one
383 def get_source(self, environment, template):
386 return loader.get_source(environment, template)
389 raise TemplateNotFound(template)