Files @ 9b48cc94e651
Branch filter:

Location: website/www/conservancy/apps/supporter/views.py

Bradley M. Kuhn
Continuing saga of the sizing chart problems for original shirts

Gildan removed the sizing chart entirely from their website again
after yet another redesign. Originally, we deep-linked into files in
their CDN for the charts, but it appears that in 5c72071 that I
introduced cut-and-paste error on the sizing charts. I cannot find
the original links, but finally I simply decided we'd mirror the
files in our CDN, which is where these now link to.

I suspect that I didn't do this to start for worrying about copyright
infringement, but upon second thought, I think it's very reasonably
fair use for us to distribute these images. We bought a lot of
t-shirts from Gildan and just trying to sell through.
import conservancy

def index(request):
    with conservancy.ParameterValidator(request.GET, 'upgrade_id') as validator:
        try:
            amount_param = float(request.GET['upgrade'])
        except (KeyError, ValueError):
            validator.fail()
        else:
            validator.validate('{:.2f}'.format(amount_param))
    partial_amount = amount_param if validator.valid else 0
    context = {
        'partial_amount': partial_amount,
        'minimum_amount': 120 - partial_amount,
    }
    return conservancy.render_template_with_context(request, "supporter/index.html", context)