Renamed get_template_from_string to from_string.
The shorter name is just as explicit and, well, shorter.
This commit is contained in:
parent
b3eda6ec3e
commit
bfa21ddf76
|
@ -121,6 +121,13 @@ class Engine(object):
|
|||
pass
|
||||
raise TemplateDoesNotExist(name)
|
||||
|
||||
def from_string(self, source, origin=None, name=None):
|
||||
"""
|
||||
Returns a compiled Template object for the given template code,
|
||||
handling template inheritance recursively.
|
||||
"""
|
||||
return Template(source, origin, name)
|
||||
|
||||
def get_template(self, template_name, dirs=_dirs_undefined):
|
||||
"""
|
||||
Returns a compiled Template object for the given template name,
|
||||
|
@ -136,16 +143,9 @@ class Engine(object):
|
|||
template, origin = self.find_template(template_name, dirs)
|
||||
if not hasattr(template, 'render'):
|
||||
# template needs to be compiled
|
||||
template = self.get_template_from_string(template, origin, template_name)
|
||||
template = self.from_string(template, origin, template_name)
|
||||
return template
|
||||
|
||||
def get_template_from_string(self, source, origin=None, name=None):
|
||||
"""
|
||||
Returns a compiled Template object for the given template code,
|
||||
handling template inheritance recursively.
|
||||
"""
|
||||
return Template(source, origin, name)
|
||||
|
||||
def render_to_string(self, template_name, dictionary=None, context_instance=None,
|
||||
dirs=_dirs_undefined):
|
||||
"""
|
||||
|
|
|
@ -24,7 +24,7 @@ def get_template(*args, **kwargs):
|
|||
|
||||
|
||||
def get_template_from_string(*args, **kwargs):
|
||||
return Engine.get_default().get_template_from_string(*args, **kwargs)
|
||||
return Engine.get_default().from_string(*args, **kwargs)
|
||||
|
||||
|
||||
def render_to_string(*args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue