I'm absolutly aggree with you Nick
But may be exists any way or hack to put my loader in next function?
...\google_appengine\lib\django\django\template\loader.py
...
def find_template_source(name, dirs=None):
# Calculate template_source_loaders the first time the function is
executed
# because putting this logic in the module-level namespace may
cause
# circular import errors. See Django ticket #1292.
global template_source_loaders
if template_source_loaders is None:
template_source_loaders = []
for path in settings.TEMPLATE_LOADERS:
...
for loader in template_source_loaders:
try:
source, display_name = loader(name, dirs)
return (source, make_origin(display_name, loader, name,
dirs))
except TemplateDoesNotExist:
pass
raise TemplateDoesNotExist, name
...
I'm asking about this because I'm not strong in python. And possible I
don't know about some facilites of language :)
On Jun 29, 1:58 pm, Nick Johnson (Google) nick.john...@google.com
wrote:
Hi BmB,
Are you using the convenience functions in
google.appengine.ext.webapp.template? These functions rewrite thetemplatepath
for their own purposes. If you want to use your owntemplateloader, you'll
have to do the work of finding loading, and
rendering yourself.
-Nick Johnson
On Fri, Jun 26, 2009 at 5:42 PM, BmBegavrile...@gmail.com wrote:
Hi. I'm trying add custom templateloader to my google-app .
main.py start with
import os
import random
import string
import sys
import wsgiref.handlers
import datetime
import simplejson
import re
from django.conf import settings
settings.configure(
TEMPLATE_LOADERS=(
'django.template.loaders.filesystem.load_template_source',
'templateloader.load_template_source',
),
)
...
where templateloader.py:
from django.templateimport TemplateDoesNotExist
def load_template_source(template_name, template_dirs=None):
...
return xxx # e.g. let
xxx===template_name
load_template_source.is_usable = True
Unfortunally it doesn't work. If file-templateisn't exists then {%
include xxx%} area remain empty.
But code
self.response.out.write(settings.TEMPLATE_LOADERS)
take: (
'django.template.loaders.filesystem.load_template_source',
'templateloader.load_template_source',
)
Where I'm wrong? I fill my mistake is in using settings.configure().
Can anybody help me?
Thanks!
--
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
Number: 368047
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---