mirror of
				https://github.com/django/django.git
				synced 2025-10-29 00:26:07 +00:00 
			
		
		
		
	Renamed get_template_from_string to from_string.
The shorter name is just as explicit and, well, shorter.
This commit is contained in:
		| @@ -121,6 +121,13 @@ class Engine(object): | |||||||
|                 pass |                 pass | ||||||
|         raise TemplateDoesNotExist(name) |         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): |     def get_template(self, template_name, dirs=_dirs_undefined): | ||||||
|         """ |         """ | ||||||
|         Returns a compiled Template object for the given template name, |         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) |         template, origin = self.find_template(template_name, dirs) | ||||||
|         if not hasattr(template, 'render'): |         if not hasattr(template, 'render'): | ||||||
|             # template needs to be compiled |             # 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 |         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, |     def render_to_string(self, template_name, dictionary=None, context_instance=None, | ||||||
|                          dirs=_dirs_undefined): |                          dirs=_dirs_undefined): | ||||||
|         """ |         """ | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ def get_template(*args, **kwargs): | |||||||
|  |  | ||||||
|  |  | ||||||
| def get_template_from_string(*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): | def render_to_string(*args, **kwargs): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user