Am 25.09.2009 um 22:04 schrieb Simon Willison:
> > On Sep 25, 4:44 pm, Johannes Dollinger > <[email protected]> wrote: >> Regarding parity, let me advertise a Signer object again: >> >> signer = signed.Signer( >> key=settings.SECRET_KEY, >> expire_after=3600 >> ) >> >> s = signer.sign(v) >> v = signer.unsign(s) >> >> signer.set_cookie(response, name, value) >> signer.get_cookie(request, name) >> # or: >> signer.get_cookies(request)[name] >> >> # transparently sign cookies set via response.set_cookie() >> # and unsign cookies in request.COOKIES in place: >> @signer.sign_cookies >> def view0(request): >> ... >> @signer.sign_cookies('cookie', 'names') >> def view1(request): >> ... >> >> This would make more options and customization feasible (by >> subclassing): > > OK, you got me. You obviously know my weakness for customisation by > subclassing :) Having a Signer class is a smart idea, I'll kick it > around a bit and see how it looks. http://dpaste.com/hold/111386/ This is how a class-based API might look. It's based on django-signed. All cookie related code is untested. __ Johannes --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
