tax.templatetags.satchmo_tax.tax_rate is broken

Create issue
Issue #1187 resolved
Patryk Zawadzki created an issue

http://bitbucket.org/chris1610/satchmo/src/tip/satchmo/apps/tax/templatetags/satchmo_tax.py#cl-96

{{{ class TaxRateNode(template.Node): """Retrieve the tax rate for a category""" def init(self, taxclass, order, digits): self.taxclass = taxclass self.order = order self.digits = digits

def render(self, context):
    taxer = _get_taxprocessor(context['request'])
    if self.order:
        try:
            order = template.resolve_variable(self.order, context)
            taxer.order = order
        except template.VariableDoesNotExist:
            pass

    pcnt = taxer.get_percent(taxclass=self.taxclass)
    if self.digits == 0:
        q = Decimal('0')
    else:
        if self.digits == 1:
            s = "0.1"
        else:
            s = "0." + "0" * self.digits-1 + "1"
        q = Decimal(s)
    return pcnt.quantize(q)

}}}

There is no way for the last "else" branch to work as it tries to substract 1 from a string ({{{"0" * self.digits}}}).

Comments (2)

  1. Log in to comment