Move session cookie saving from Session.request() to Request._build_response()

This commit is contained in:
Roman Haritonov
2012-05-08 13:02:39 +04:00
parent 975430d5e6
commit 33f1087584
2 changed files with 6 additions and 6 deletions
+6
View File
@@ -203,6 +203,12 @@ class Request(object):
# Save cookies in Response.
response.cookies = self.cookies
# Save cookies in Session.
# (in safe mode, cookies may be None if the request didn't succeed)
if self.cookies is not None:
for cookie in self.cookies:
self.session.cookies.set_cookie(cookie)
# No exceptions were harmed in the making of this request.
response.error = getattr(resp, 'error', None)
-6
View File
@@ -228,12 +228,6 @@ class Session(object):
# Send the HTTP Request.
r.send(prefetch=prefetch)
# Send any cookies back up the to the session.
# (in safe mode, cookies may be None if the request didn't succeed)
if r.response.cookies is not None:
for cookie in r.response.cookies:
self.cookies.set_cookie(cookie)
# Return the response.
return r.response