Esempio n. 1
0
def range_currency(value):
    values = None
    if value == '' or value is None:
        return value

    try:
        value = Decimal(str(value))
    except InvalidOperation:
        values = [mark_safe(moneyfmt(Decimal(str(val)))) for val in value.split(' - ')]

    if values:
        return mark_safe(' - '.join(values))

    return mark_safe(moneyfmt(value, **kwargs))
Esempio n. 2
0
def wrap_currency(value, args=""):
    if value == '' or value is None:
        return value

    try:
        value = Decimal(str(value))
    except InvalidOperation:
        log.error("Could not convert value '%s' to decimal", value)
        raise

    return mark_safe(moneyfmt(value, wrapval='label'))