]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/lib/helpers.py
added XSRF protection to all forms and associated tests
[bluechips.git] / bluechips / lib / helpers.py
1 """Helper functions
2
3 Consists of functions to typically be used within templates, but also
4 available to Controllers. This module is available to both as 'h'.
5 """
6 from routes import url_for, redirect_to
7 from webhelpers.html import escape, literal, url_escape
8 from webhelpers.html.tags import *
9 from webhelpers.html.secure_form import *
10
11 from webhelpers.pylonslib import Flash as _Flash
12
13 from decimal import Decimal
14
15 def currency(name, value, *args, **kwargs):
16     if 'class_' not in kwargs:
17         kwargs['class_'] = ''
18     kwargs['class_'] += 'currency'
19     value = "%0.2f" % (int(value) / 100.)
20     return text(name, value, *args, **kwargs)
21
22 flash = _Flash()