Merge branch 'master' into gilbert
[philo.git] / loaders / database.py
1 from django.template import TemplateDoesNotExist
2 from django.template.loader import BaseLoader
3 from django.utils.encoding import smart_unicode
4 from philo.models import Template
5
6
7 class Loader(BaseLoader):
8         is_usable=True
9         
10         def load_template_source(self, template_name, template_dirs=None):
11                 try:
12                         template = Template.objects.get_with_path(template_name)
13                 except Template.DoesNotExist:
14                         raise TemplateDoesNotExist(template_name)
15                 return (template.code, smart_unicode(template))