Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow setting cookies with dict

  • Loading branch information...
commit 865d9db45e3f467c4f1dbf0b6df07337fd42854f 1 parent dfaf7ec
Aaron Dufour authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 pump/middleware/cookies.py
View
9 pump/middleware/cookies.py
@@ -29,8 +29,11 @@ def wrapped_app(request):
updated_cookies = request.get("cookies", {}).copy()
cookie_header = []
for k, v in updated_cookies.iteritems():
- v = str(v)
- if k not in req_cookies or req_cookies[k] != v:
+ try:
+ value = v.get("value")
+ except AttributeError:
+ value = str(v)
+ if k not in req_cookies or req_cookies[k] != value:
cookie_header.append(_format_cookie(k, v))
response.setdefault("headers", {})["set_cookie"] = cookie_header
@@ -59,4 +62,4 @@ def _format_cookie(key, val):
morsel = cookie[key]
for k, v in val.iteritems():
morsel[k] = v
- return morsel.OutputString()
+ return morsel.OutputString()
Please sign in to comment.
Something went wrong with that request. Please try again.