﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17931	set_cookie timezone naive vs aware	James Addison	Aymeric Augustin	"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."	Bug	closed	HTTP handling	dev	Release blocker	fixed	timezone, cookie		Accepted	1	0	0	0	0	0
