Created
May 1, 2014 13:36
-
-
Save agamdua/b2ce859a6acec34454fd to your computer and use it in GitHub Desktop.
Template class from base.py in Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Template(object): | |
def __init__(self, template_string, origin=None, name=None): | |
try: | |
template_string = force_text(template_string) | |
except UnicodeDecodeError: | |
raise TemplateEncodingError("Templates can only be constructed " | |
"from unicode or UTF-8 strings.") | |
if settings.TEMPLATE_DEBUG and origin is None: | |
origin = StringOrigin(template_string) | |
self.nodelist = compile_string(template_string, origin) | |
self.name = name | |
self.origin = origin | |
# the rest is left out for conciseness. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment