def currency(value): """ Format value as a currency. """ return h.format_decimal(Decimal(value).quantize(Decimal(".01"), ROUND_HALF_UP))
def _from_python(self, value, state): if self.if_empty is not formencode.NoDefault and not value: return '' return format_decimal(value)