Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/notifications/web/notification.py

Issue 6402627529080832: Issue 2610 - Return notification version in a response header (Closed)
Patch Set: Created May 30, 2015, 8:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/notifications/web/notification.py
===================================================================
--- a/sitescripts/notifications/web/notification.py
+++ b/sitescripts/notifications/web/notification.py
@@ -61,8 +61,7 @@
if "notifications" not in response:
response["notifications"] = [x for x in notifications
if "variants" not in x]
- return json.dumps(response, ensure_ascii=False, indent=2,
- separators=(",", ": "), sort_keys=True)
+ return response
@url_handler("/notification.json")
def notification(environ, start_response):
@@ -81,6 +80,10 @@
if not groups:
groups = _assign_groups(notifications)
response = _create_response(notifications, groups)
- start_response("200 OK",
- [("Content-Type", "application/json; charset=utf-8")])
- return response.encode("utf-8")
+ response_headers = [("Content-Type", "application/json; charset=utf-8"),
+ ("ABP-Notification-Version", response["version"])]
+ response_body = json.dumps(response, ensure_ascii=False, indent=2,
+ separators=(",", ": "),
+ sort_keys=True).encode("utf-8")
+ start_response("200 OK", response_headers)
+ return response_body

Powered by Google App Engine
This is Rietveld