[CalendarServer-changes] [11764] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Sep 30 13:09:37 PDT 2013


Revision: 11764
          http://trac.calendarserver.org//changeset/11764
Author:   cdaboo at apple.com
Date:     2013-09-30 13:09:36 -0700 (Mon, 30 Sep 2013)
Log Message:
-----------
Return an error if DAV:limit used in sync report since we do not support that.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
    CalendarServer/trunk/txdav/xml/rfc6578.py

Modified: CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py	2013-09-30 20:08:31 UTC (rev 11763)
+++ CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py	2013-09-30 20:09:36 UTC (rev 11764)
@@ -58,6 +58,14 @@
 
     responses = []
 
+    # Do not support limit
+    if sync_collection.sync_limit is not None:
+        raise HTTPError(ErrorResponse(
+            responsecode.INSUFFICIENT_STORAGE_SPACE,
+            element.NumberOfMatchesWithinLimits(),
+            "Report limit not supported",
+        ))
+
     # Process Depth and sync-level for backwards compatibility
     # Use sync-level if present and ignore Depth, else use Depth
     if sync_collection.sync_level:

Modified: CalendarServer/trunk/txdav/xml/rfc6578.py
===================================================================
--- CalendarServer/trunk/txdav/xml/rfc6578.py	2013-09-30 20:08:31 UTC (rev 11763)
+++ CalendarServer/trunk/txdav/xml/rfc6578.py	2013-09-30 20:09:36 UTC (rev 11764)
@@ -7,10 +7,10 @@
 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 # copies of the Software, and to permit persons to whom the Software is
 # furnished to do so, subject to the following conditions:
-# 
+#
 # The above copyright notice and this permission notice shall be included in all
 # copies or substantial portions of the Software.
-# 
+#
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -51,7 +51,7 @@
     allowed_children = {
         (dav_namespace, "sync-token"): (0, 1), # When used in the REPORT this is required
         (dav_namespace, "sync-level"): (0, 1), # When used in the REPORT this is required
-        (dav_namespace, "prop"      ): (0, 1),
+        (dav_namespace, "prop"): (0, 1),
     }
 
     def __init__(self, *children, **attributes):
@@ -60,6 +60,7 @@
         self.property = None
         self.sync_token = None
         self.sync_level = None
+        self.sync_limit = None
 
         for child in self.children:
             qname = child.qname()
@@ -70,12 +71,20 @@
             elif qname == (dav_namespace, "sync-level"):
                 self.sync_level = str(child)
 
+            elif qname == (dav_namespace, "limit"):
+                if len(child.children) == 1 and child.children[0].qname() == (dav_namespace, "nresults"):
+                    try:
+                        self.sync_limit = int(str(child.children[0]))
+                    except TypeError:
+                        pass
+
             elif qname == (dav_namespace, "prop"):
                 if self.property is not None:
                     raise ValueError("Only one of DAV:prop allowed")
                 self.property = child
 
 
+
 @registerElement
 @registerElementClass
 class SyncToken (WebDAVTextElement):
@@ -87,6 +96,7 @@
     protected = True
 
 
+
 @registerElement
 @registerElementClass
 class SyncLevel (WebDAVTextElement):
@@ -96,5 +106,29 @@
     name = "sync-level"
 
 
+
+ at registerElement
+ at registerElementClass
+class Limit (WebDAVElement):
+    """
+    Synchronization limit in report.
+    """
+    name = "limit"
+
+    allowed_children = {
+        (dav_namespace, "nresults"): (1, 1), # When used in the REPORT this is required
+    }
+
+
+
+ at registerElement
+ at registerElementClass
+class NResults (WebDAVTextElement):
+    """
+    Synchronization numerical limit.
+    """
+    name = "nresults"
+
+
 # Extend MultiStatus, to add sync-token
 MultiStatus.allowed_children[(dav_namespace, "sync-token")] = (0, 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130930/294c221c/attachment-0001.html>


More information about the calendarserver-changes mailing list