#17931: set_cookie timezone naive vs aware ---------------------------------+------------------------------ Reporter: jaddison | Owner: nobody Type: Bug | Status: new Component: HTTP handling | Version: SVN Severity: Release blocker | Keywords: timezone, cookie Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------------+------------------------------ I appear to be unable to set a cookie when using the following in my settings and code:
{{{#!python from django.utils import timezone TIME_ZONE = 'America/Vancouver' USE_TZ=True }}} I get the following traceback: {{{#!python Traceback (most recent call last): File "/Users/jaddison/projects/testproj/src/django/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/Users/jaddison/projects/testproj/src/django/django/views/decorators/csrf.py", line 77, in wrapped_view return view_func(*args, **kwargs) File "/Users/jaddison/projects/testproj/project/apps/facebookapp/views.py", line 61, in tab response.set_cookie('referral_data', "page-%s" % page.id, expires=timezone.now() + datetime.timedelta(days=settings.SIGNUP_REFERRAL_COOKIE_DURATION)) File "/Users/jaddison/projects/testproj/src/django/django/http/__init__.py", line 651, in set_cookie delta = expires - expires.utcnow() TypeError: can't subtract offset-naive and offset-aware datetimes }}} I *think* that set_cookie needs to be checked for aware vs naive datetime handling, but I'm not sure. Am willing to provide more information upon request. -- Ticket URL: <https://code.djangoproject.com/ticket/17931> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.