the mothed is :
def printa(x):
return x
the reponse is :
self.response.out.write(template.render(path, {'printa':printa}))
the html is :
{{ printa 'sss'}}
i want to show 'sss' in my page ,
so how to do this ,
thanks
updated
i create a templatetags folder, and 2 py file:
templatetags
|--------__init__.py
|--------tags.py
in tags.py is :
#from django import template
from google.appengine.ext.webapp import template
register = template.Library()
def printa():
return 'ssss'
register.simple_tag(printa)
the html is :
{% load tags%}
{% printa %}
but it show error,and the error is :
TemplateSyntaxError: 'tags' is not a valid tag library: Could not load template library from django.templatetags.tags, No module named tags
why ?
what's wrong ?
thanks
answer is :
tags.py:
from google.appengine.ext import webapp
register = webapp.template.create_template_register()
@register.filter
def printa(value,y):
return 'url:%s' % y
@register.tag
def printb(x,y):
return str(x.__dict__) +'dddddddddddddddddddddddddddddddd'+ str(y.__dict__)
#return x
#register.tag('printb',do_pagednav)
and then in html (a is a variable i send to the template):
{{a|printa:"dwqdq"}}
{% printb %}
woring:
don't use load :
{% load sometags %}