Django 1.6 introduced changes which limits the data types that can be stored in sessions, specifically Decimal in this case:
https://docs.djangoproject.com/en/1.6/releases/1.6/#default-session-serialization-switched-to-json Here's a commit which addressed this in Cartridge, but the tax handling was probably overlooked: https://github.com/stephenmcd/cartridge/commit/01d7b55e416681059153d48e57d0913e1e8760ef The strategy there was to just convert Decimal to string and back again where appropriate - if you're able to work on applying the same approach to tax handling, that'd be great. Either way I've opened an issue here: https://github.com/stephenmcd/cartridge/issues/176 On Thu, Feb 27, 2014 at 11:27 AM, Josh Cartmell <[email protected]>wrote: > It's been awhile since I've used Cartridge in a project, but I have one > that I'm working on right now. I was pleased to see that Cartridge now has > tax support, but I'm running into some issues. Right now for my tax > handler I have: > > total = request.cart.total_price() > if request.session.has_key('discount'): > discount = > request.cart.calculate_discount(request.session['discount']) > total -= discount > tax = total * Decimal('.0875') > set_tax(request, "Tax", tax) > > For now I've hardcoded 8.75% as the tax rate. This always produces the > following error: > > Decimal('1.7500') is not JSON serializable > > In this case 1.75 is 8.75% of 20, the total in this particular case. > > A few questions: > > - What type of value should be passed into set_tax? > - Am I calculating the total appropriately? > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
