Skip to content

Instantly share code, notes, and snippets.

@justquick
Created August 25, 2010 04:18
Show Gist options
  • Save justquick/548845 to your computer and use it in GitHub Desktop.
Save justquick/548845 to your computer and use it in GitHub Desktop.
def do_add(x, y):
return x + y
do_add.function = True
do_add.name = 'add'
{% add 1 9 as ten %}
1 + 9 = {{ ten }}
def less(x, y):
return x < y
less.comparison = True
less.test = {'args': (1,0), 'result': False}
{% if_less some_object.id 3 %}
{{ some_object }} has an id less than 3.
{% endif_less %}
def do_del(context, name):
del context[name]
return ''
do_del.function = True
do_del.name = 'del'
do_del.takes_context = True
do_del.resolve = False
{% del request %}
def render_block(context, nodelist):
return nodelist.render(context)
render_block.block = True
{% render_block as path %}
{{ request.path }}
{% endrender_block %}
def slashdot():
return feedparser.parse('http://rss.slashdot.org/Slashdot/slashdotIT')
slashdot.cache = 3600
slashdot.fallback = {'entries': []}
{% slashdot as slashdot_items %}
{% for entry in slashdot_items.entries %}
...
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment