[CalendarServer-changes] [14537] CalendarServer/branches/users/sagen/trashcan-5

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 9 15:53:51 PDT 2015


Revision: 14537
          http://trac.calendarserver.org//changeset/14537
Author:   sagen at apple.com
Date:     2015-03-09 15:53:51 -0700 (Mon, 09 Mar 2015)
Log Message:
-----------
Getting closer to having all unit tests pass

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/test/test_collectioncontents.py
    CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py
    CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py
    CalendarServer/branches/users/sagen/trashcan-5/txdav/carddav/datastore/sql.py
    CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py
    CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql_external.py

Modified: CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/test/test_collectioncontents.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/test/test_collectioncontents.py	2015-03-09 21:24:54 UTC (rev 14536)
+++ CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/test/test_collectioncontents.py	2015-03-09 22:53:51 UTC (rev 14537)
@@ -48,7 +48,7 @@
                    _getFakeMemcacheProtocol)
 
         # Need to not do implicit behavior during these tests
-        def _fakeDoImplicitScheduling(self, component, inserting, internal_state, options):
+        def _fakeDoImplicitScheduling(self, component, inserting, internal_state, options, updateSelf=False):
             return False, None, False, None
 
         self.patch(CalendarObject, "doImplicitScheduling",

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py	2015-03-09 21:24:54 UTC (rev 14536)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py	2015-03-09 22:53:51 UTC (rev 14537)
@@ -70,7 +70,10 @@
 
         # Check recurring
         if not ical.isRecurring():
-            fullyInFuture = (ical.mainComponent().getStartDateUTC() >= now)
+            try:
+                fullyInFuture = (ical.mainComponent().getStartDateUTC() >= now)
+            except AttributeError:
+                fullyInFuture = False
             return (False, fullyInFuture)
 
         instances = ical.cacheExpandedTimeRanges(now)

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py	2015-03-09 21:24:54 UTC (rev 14536)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/sql.py	2015-03-09 22:53:51 UTC (rev 14537)
@@ -3983,6 +3983,7 @@
         if isinbox: # bypass the trash
             yield super(CalendarObject, self).reallyRemove()
         else:
+            calendar = (yield self.componentForUser())
             status = calendar.mainComponent().getProperty("STATUS")
             if status is not None:
                 status = status.strvalue()

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/carddav/datastore/sql.py	2015-03-09 21:24:54 UTC (rev 14536)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/carddav/datastore/sql.py	2015-03-09 22:53:51 UTC (rev 14537)
@@ -1204,7 +1204,7 @@
 
     @classmethod
     @inlineCallbacks
-    def objectWithName(cls, home, name, accepted=True):
+    def objectWithName(cls, home, name, accepted=True, onlyInTrash=False):
         """
         Retrieve the child with the given C{name} contained in the given
         C{home}.
@@ -1232,7 +1232,7 @@
 
     @classmethod
     @inlineCallbacks
-    def objectWithID(cls, home, resourceID, accepted=True):
+    def objectWithID(cls, home, resourceID, accepted=True, onlyInTrash=False):
         """
         Retrieve the child with the given C{resourceID} contained in the given
         C{home}.

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py	2015-03-09 21:24:54 UTC (rev 14536)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql.py	2015-03-09 22:53:51 UTC (rev 14537)
@@ -3464,7 +3464,7 @@
 
         if not self._childrenLoaded:
             yield self.loadChildren()
-        names = [k for k in self._children[self._childrenKey(onlyInTrash)].keys() if isinstance(k, str)]
+        names = [k for k in self._children[self._childrenKey(onlyInTrash)].keys() if not isinstance(k, int)]
         returnValue(names)
 
 
@@ -3549,12 +3549,12 @@
         child = yield self.childWithName(name)
         if child is None:
             raise NoSuchHomeChildError()
+        key = self._childrenKey(child.isInTrash())
         resourceID = child._resourceID
 
         yield child.remove()
-        for d in self._children:
-            d.pop(name, None)
-            d.pop(resourceID, None)
+        self._children[key].pop(name, None)
+        self._children[key].pop(resourceID, None)
 
 
     @inlineCallbacks
@@ -6250,7 +6250,7 @@
 
 
     def isInTrash(self):
-        return self._isInTrash
+        return getattr(self, "_isInTrash", False)
 
 
 

Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql_external.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql_external.py	2015-03-09 21:24:54 UTC (rev 14536)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/common/datastore/sql_external.py	2015-03-09 22:53:51 UTC (rev 14537)
@@ -216,8 +216,8 @@
 
     @classmethod
     @inlineCallbacks
-    def objectWith(cls, home, name=None, resourceID=None, externalID=None, accepted=True):
-        mapping = yield home._txn.store().conduit.send_homechild_objectwith(home, name, resourceID, externalID, accepted)
+    def objectWith(cls, home, name=None, resourceID=None, externalID=None, accepted=True, onlyInTrash=False):
+        mapping = yield home._txn.store().conduit.send_homechild_objectwith(home, name, resourceID, externalID, accepted, onlyInTrash)
 
         if mapping:
             child = yield cls.internalize(home, mapping)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150309/b0b8bd89/attachment.html>


More information about the calendarserver-changes mailing list