Revision: 3578 http://trac.macosforge.org/projects/calendarserver/changeset/3578 Author: sagen@apple.com Date: 2009-01-08 14:23:26 -0800 (Thu, 08 Jan 2009) Log Message: ----------- Aggregate good and bad propstats into one response element rather than two Modified Paths: -------------- CalendarServer/trunk/twistedcaldav/method/report_common.py Added Paths: ----------- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.prop_common.patch Added: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.prop_common.patch =================================================================== --- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.prop_common.patch (rev 0) +++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.prop_common.patch 2009-01-08 22:23:26 UTC (rev 3578) @@ -0,0 +1,36 @@ +Index: twisted/web2/dav/method/prop_common.py +=================================================================== +--- twisted/web2/dav/method/prop_common.py (revision 19773) ++++ twisted/web2/dav/method/prop_common.py (working copy) +@@ -23,19 +23,21 @@ + properties_by_status = waitForDeferred(propertiesForResource(request, propertyreq, resource)) + yield properties_by_status + properties_by_status = properties_by_status.getResult() +- ++ ++ propstats = [] ++ + for status in properties_by_status: + properties = properties_by_status[status] + if properties: +- responses.append( +- davxml.PropertyStatusResponse( +- href, +- davxml.PropertyStatus( +- davxml.PropertyContainer(*properties), +- davxml.Status.fromResponseCode(status) +- ) +- ) +- ) ++ xml_status = davxml.Status.fromResponseCode(status) ++ xml_container = davxml.PropertyContainer(*properties) ++ xml_propstat = davxml.PropertyStatus(xml_container, xml_status) ++ ++ propstats.append(xml_propstat) ++ ++ if propstats: ++ responses.append(davxml.PropertyStatusResponse(href, *propstats)) ++ + else: + responses.append( + davxml.StatusResponse( Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py =================================================================== --- CalendarServer/trunk/twistedcaldav/method/report_common.py 2009-01-07 22:54:17 UTC (rev 3577) +++ CalendarServer/trunk/twistedcaldav/method/report_common.py 2009-01-08 22:23:26 UTC (rev 3578) @@ -116,19 +116,20 @@ """ def _defer(properties_by_status): + propstats = [] + for status in properties_by_status: properties = properties_by_status[status] if properties: - responses.append( - davxml.PropertyStatusResponse( - href, - davxml.PropertyStatus( - davxml.PropertyContainer(*properties), - davxml.Status.fromResponseCode(status) - ) - ) - ) + xml_status = davxml.Status.fromResponseCode(status) + xml_container = davxml.PropertyContainer(*properties) + xml_propstat = davxml.PropertyStatus(xml_container, xml_status) + propstats.append(xml_propstat) + + if propstats: + responses.append(davxml.PropertyStatusResponse(href, *propstats)) + d = propertiesForResource(request, propertyreq, resource, calendar, timezone, isowner) d.addCallback(_defer) return d
participants (1)
-
source_changes@macosforge.org