Ticket #16499: loader.py.diff
File loader.py.diff, 850 bytes (added by , 13 years ago) |
---|
-
loader.py
31 31 from django.conf import settings 32 32 33 33 template_source_loaders = None 34 template_cache = {} 34 35 35 36 class BaseLoader(object): 36 37 is_usable = False … … 151 152 152 153 def get_template(template_name): 153 154 """ 155 Improve load template performance, add a template cache for load 156 template. 157 """ 158 global template_cache 159 if template_cache.has_key(template_name): 160 return template_cache[template_name] 161 else: 162 template = do_get_template(template_name) 163 template_cache[template_name] = template 164 return template 165 166 def do_get_template(template_name): 167 """ 154 168 Returns a compiled Template object for the given template name, 155 169 handling template inheritance recursively. 156 170 """