3 Consists of functions to typically be used within templates, but also
4 available to Controllers. This module is available to both as 'h'.
6 from datetime import date
7 from decimal import Decimal
9 from pylons import request
10 from routes import url_for, redirect_to
11 from webhelpers.html import escape, literal, url_escape
12 from webhelpers.html.tags import *
13 from webhelpers.html.secure_form import *
15 from webhelpers.pylonslib import Flash as _Flash
18 def currency(name, value, *args, **kwargs):
19 if 'class_' not in kwargs:
21 kwargs['class_'] += 'currency'
22 value = "%0.2f" % (int(value) / 100.)
23 return text(name, value, *args, **kwargs)
28 return getattr(obj, attr)
32 elif attr in ('spender_id', 'creditor_id', 'debtor_id'):
33 return request.environ['user'].id
34 elif attr == 'amount':