[CalendarServer-changes] [14183] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 17 08:55:35 PST 2014


Revision: 14183
          http://trac.calendarserver.org//changeset/14183
Author:   cdaboo at apple.com
Date:     2014-11-17 08:55:35 -0800 (Mon, 17 Nov 2014)
Log Message:
-----------
Use problem+json subtype for JSON error response in tzdist protocol.

Modified Paths:
--------------
    CalendarServer/trunk/requirements-dev.txt
    CalendarServer/trunk/twistedcaldav/timezonestdservice.py
    CalendarServer/trunk/txweb2/http.py

Modified: CalendarServer/trunk/requirements-dev.txt
===================================================================
--- CalendarServer/trunk/requirements-dev.txt	2014-11-17 16:53:58 UTC (rev 14182)
+++ CalendarServer/trunk/requirements-dev.txt	2014-11-17 16:55:35 UTC (rev 14183)
@@ -7,4 +7,4 @@
 mockldap
 q
 --editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@13420#egg=CalDAVClientLibrary
---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@14178#egg=CalDAVTester
+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@14182#egg=CalDAVTester

Modified: CalendarServer/trunk/twistedcaldav/timezonestdservice.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/timezonestdservice.py	2014-11-17 16:53:58 UTC (rev 14182)
+++ CalendarServer/trunk/twistedcaldav/timezonestdservice.py	2014-11-17 16:55:35 UTC (rev 14183)
@@ -207,6 +207,7 @@
                 "title": description,
                 "status": status,
             },
+            contentType="application/problem+json",
             pretty=config.TimezoneService.PrettyPrintJSON,
         ))
 

Modified: CalendarServer/trunk/txweb2/http.py
===================================================================
--- CalendarServer/trunk/txweb2/http.py	2014-11-17 16:53:58 UTC (rev 14182)
+++ CalendarServer/trunk/txweb2/http.py	2014-11-17 16:55:35 UTC (rev 14183)
@@ -557,7 +557,7 @@
     JSON L{Response} object.
     Renders itself as an JSON document.
     """
-    def __init__(self, code, jobj, pretty=False):
+    def __init__(self, code, jobj, contentType="application/json", pretty=False):
         """
         @param jobj: a Python object that can be serialized to JSON.
         """
@@ -566,7 +566,7 @@
             kwargs["indent"] = 2
             kwargs["separators"] = (',', ':')
         Response.__init__(self, code, stream=json.dumps(jobj, **kwargs))
-        self.headers.setHeader("content-type", http_headers.MimeType("application", "json"))
+        self.headers.setHeader("content-type", http_headers.MimeType(*contentType.split("/")))
 
 
 components.registerAdapter(Response, int, iweb.IResponse)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141117/2e75c161/attachment-0001.html>


More information about the calendarserver-changes mailing list