Advertisement
include

Untitled

Jan 2nd, 2014
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import bottle
  2.  
  3. from bottle import Jinja2Template
  4. from bottle import jinja2_template as template
  5.  
  6. from jinja2 import Environment
  7.  
  8.  
  9. def cuti(value):
  10.     return value[:7]
  11.  
  12. env = Environment()
  13. env.filters['cuti'] = cuti
  14.  
  15.  
  16. @bottle.route('/')
  17. def test():
  18.     foo = "klsjadlkjdalkdjdaskldjad007"
  19.     return template('''
  20.  
  21. foo value: {{ foo|cuti }}
  22. ''', foo=foo)
  23.  
  24.  
  25. bottle.run(host='localhost', port=9090, debug=True, reloader=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement