Search code examples
google-app-enginewebapp2

Webapp2 custom tags


I am migrating from webapp1 to webapp2 and from python 2.5 to python2.7 I had some custom tags I used with

webapp.template.register_template_library('common.templatetags')

and registered with:

from google.appengine.ext.webapp import template
register = template.create_template_register()

and the corresponding decorator and everything else worked fine

now I need to use webapp2 which does not have template.register.....

I tried doing it this way : http://www.john-smith.me/Tag/webapp2 but it didn't work

thanks


Solution

  • solved by using add_to_builtins()

    from django.template.loader import add_to_builtins
    
    add_to_builtins('myapp.templatetags.mytagslib')