Created
August 13, 2010 07:46
-
-
Save rafacv/522505 to your computer and use it in GitHub Desktop.
Callable bug with Pystache's View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import pystache | |
>>> from pystache import view | |
>>> | |
>>> class Dummy(view.View): | |
... pass | |
... | |
>>> context = {'icecream': lambda flavor: "%s icecream" % flavor, 'title': 'Yummy'} | |
>>> template = "** {{title}}\n\n {{#icecream}}Strawberry{{/icecream}}" | |
>>> | |
>>> context2 = dict(context.items()) | |
>>> context2['icecream'] = True | |
>>> | |
>>> dummy = Dummy(template, context) | |
>>> dummy.render() | |
u'** Yummy\n\n ' | |
>>> dummy2 = Dummy(template, context2) | |
>>> dummy2.render() | |
u'** Yummy\n\n Strawberry' | |
>>> pystache.render(template, context) | |
u'** Yummy\n\n Strawberry icecream' | |
>>> pystache.render(template, context2) | |
u'** Yummy\n\n Strawberry' | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment