Extending Django Templates

45 views
Skip to first unread message

notreadbyhumans

unread,
Aug 30, 2008, 2:17:38 PM8/30/08
to Google App Engine
I'm trying to extend the Google App Engine templates using the
instructions in the post below (I have tried the instructions in this
post and the one below):

http://groups.google.com/group/google-appengine/browse_thread/thread/d791ce17e2716147/2886c968a25c1d1a?lnk=gst&q=Extending+django#2886c968a25c1d1a

However I can't seem to get it to take. I have created a folder in my
app's directory called template_extras, which contains the __init__.py
file and an extensions.py file containing the following:


from google.appengine.ext.webapp import template

register = template.create_template_register()

@register.filter

def ProcessThis(value):
return value


Within my main.py I have the following:


def get(self):

template.register_template_library('template_extras')


The error I get with this configuration is:


InvalidTemplateLibrary: Template library template_extras does not have
a variable named 'register'


Any ideas gratefully received!!

Alexander Kojevnikov

unread,
Sep 1, 2008, 10:45:07 PM9/1/08
to Google App Engine
Try replacing

template.register_template_library('template_extras')

with

template.register_template_library('template_extras.extensions')

Check google/appengine/ext/webapp/template.py lines 162-194 for
details.

On Aug 31, 4:17 am, notreadbyhumans <notreadbyhum...@gmail.com> wrote:
> I'm trying to extend the Google App Engine templates using the
> instructions in the post below (I have tried the instructions in this
> post and the one below):
>
> http://groups.google.com/group/google-appengine/browse_thread/thread/...
Reply all
Reply to author
Forward
0 new messages