[CalendarServer-changes] [14104] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 24 17:23:04 PDT 2014


Revision: 14104
          http://trac.calendarserver.org//changeset/14104
Author:   sagen at apple.com
Date:     2014-10-24 17:23:04 -0700 (Fri, 24 Oct 2014)
Log Message:
-----------
Fix augment problem where groups' hasCalendars/hasContacts was not being set to False

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py
    CalendarServer/trunk/txdav/who/augment.py

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py	2014-10-24 21:12:40 UTC (rev 14103)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py	2014-10-25 00:23:04 UTC (rev 14104)
@@ -604,7 +604,9 @@
                 )
 
                 # Verify that if not enabled for calendaring, no CUAs:
-                record.hasCalendars = False
+                record.fields[
+                    record.service.fieldName.lookupByName(u"hasCalendars")
+                ] = False
                 self.failIf(recordResource.calendarUserAddresses())
 
 
@@ -638,9 +640,13 @@
 
                 # Turn off hasContacts and addressBookHomeURLs
                 # should be empty
-                record.hasContacts = False
+                record.fields[
+                    record.service.fieldName.lookupByName(u"hasContacts")
+                ] = False
                 self.failIf(tuple(recordResource.addressBookHomeURLs()))
-                record.hasContacts = True
+                record.fields[
+                    record.service.fieldName.lookupByName(u"hasContacts")
+                ] = True
 
                 addressBookRootResource = yield self.actualRoot.getChild("addressbooks")
                 addressBookRootURL = addressBookRootResource.url()
@@ -697,9 +703,13 @@
 
                 # Turn off hasCalendars and calendarHomeURLs should
                 # be empty
-                record.hasCalendars = False
+                record.fields[
+                    record.service.fieldName.lookupByName(u"hasCalendars")
+                ] = False
                 self.failIf(tuple(recordResource.calendarHomeURLs()))
-                record.hasCalendars = True
+                record.fields[
+                    record.service.fieldName.lookupByName(u"hasCalendars")
+                ] = True
 
                 calendarRootResource = yield self.rootResource.getChild("calendars")
                 calendarRootURL = calendarRootResource.url()

Modified: CalendarServer/trunk/txdav/who/augment.py
===================================================================
--- CalendarServer/trunk/txdav/who/augment.py	2014-10-24 21:12:40 UTC (rev 14103)
+++ CalendarServer/trunk/txdav/who/augment.py	2014-10-25 00:23:04 UTC (rev 14104)
@@ -390,19 +390,21 @@
 
         fields = record.fields.copy()
 
-        # print("Got augment record", augmentRecord)
-
         if augmentRecord:
 
-            self._assignToField(
-                fields, "hasCalendars",
-                augmentRecord.enabledForCalendaring
-            )
+            if record.recordType == RecordType.group:
+                self._assignToField(fields, "hasCalendars", False)
+                self._assignToField(fields, "hasContacts", False)
+            else:
+                self._assignToField(
+                    fields, "hasCalendars",
+                    augmentRecord.enabledForCalendaring
+                )
 
-            self._assignToField(
-                fields, "hasContacts",
-                augmentRecord.enabledForAddressBooks
-            )
+                self._assignToField(
+                    fields, "hasContacts",
+                    augmentRecord.enabledForAddressBooks
+                )
 
             autoScheduleMode = {
                 "none": AutoScheduleMode.none,
@@ -442,29 +444,7 @@
                 augmentRecord.serverID.decode("utf-8")
             )
 
-            if (
-                (
-                    fields.get(
-                        self.fieldName.lookupByName("hasCalendars"), False
-                    ) or
-                    fields.get(
-                        self.fieldName.lookupByName("hasContacts"), False
-                    )
-                ) and
-                record.recordType == RecordType.group
-            ):
-                self._assignToField(fields, "hasCalendars", False)
-                self._assignToField(fields, "hasContacts", False)
 
-                # For augment records cloned from the Default augment record,
-                # don't emit this message:
-                if not augmentRecord.clonedFromDefault:
-                    log.error(
-                        "Group {record} cannot be enabled for "
-                        "calendaring or address books",
-                        record=record
-                    )
-
         else:
             self._assignToField(fields, "hasCalendars", False)
             self._assignToField(fields, "hasContacts", False)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141024/20757ff2/attachment.html>


More information about the calendarserver-changes mailing list