I haven't moved to 1.3 yet, but we do a few things with the template
source too so this is definitely of interest.  It looks like most of
the template loaders define a load_template_source method
implementation that does return the source, except for the cached
loader.  As a work around you could add a module with your own
find_template_source() method based on the existing, but calling the
load_template_source() method instead:

from django.template.loader import
template_source_loaders,find_template_loader,make_origin,TemplateDoesNotExist
from django.conf import settings

def find_template_source(name, dirs=None):
    global template_source_loaders
    if template_source_loaders is None:
        loaders = []
        for loader_name in settings.TEMPLATE_LOADERS:
            loader = find_template_loader(loader_name)
            if loader is not None:
                loaders.append(loader)
        template_source_loaders = tuple(loaders)
    for loader in template_source_loaders:
        try:
            source, display_name = loader.load_template_source(name,
dirs)
            return (source, make_origin(display_name, loader, name,
dirs))
        except TemplateDoesNotExist:
            pass
        except NotImplementedError:
            pass
    raise TemplateDoesNotExist(name)


If you want to use the cache loader too, you'd have to subclass it and
define your own load_template_source() implementation.  I hope this
functionality gets added back to the core.  There isn't any reason not
to that I can see.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to