[CalendarServer-changes] [14152] CalendarServer/trunk/calendarserver/tools
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 10 13:52:47 PST 2014
Revision: 14152
http://trac.calendarserver.org//changeset/14152
Author: sagen at apple.com
Date: 2014-11-10 13:52:47 -0800 (Mon, 10 Nov 2014)
Log Message:
-----------
Handle setting PARTSTAT of attendees across multiple instances when importing
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/importer.py
CalendarServer/trunk/calendarserver/tools/test/test_importer.py
Modified: CalendarServer/trunk/calendarserver/tools/importer.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/importer.py 2014-11-10 21:34:20 UTC (rev 14151)
+++ CalendarServer/trunk/calendarserver/tools/importer.py 2014-11-10 21:52:47 UTC (rev 14152)
@@ -255,20 +255,19 @@
resourceName = yield collection.resourceNameForUID(uid)
print("Resource name", collection, resourceName)
object = yield collection.objectResourceWithName(resourceName)
- component = yield object.component()
+ component = yield object.componentForUser()
print ("Comp", component)
ownerCUA = ownerRecord.canonicalCalendarUserAddress()
print("CUA", ownerCUA)
- attendeeProp = component.getAttendeeProperty((ownerCUA,))
- print("att prop", attendeeProp)
- if attendeeProp is not None:
- print("Before", attendeeProp)
- attendeeProp.setParameter("PARTSTAT", "NEEDS-ACTION")
- attendeeProp.removeParameter("SCHEDULE-STATUS")
- print("I modified", attendeeProp)
- result = yield object.setComponent(component)
- print("Set component result", result)
+ for attendeeProp in (yield component.getAttendeeProperties((ownerCUA,))):
+ print("att prop", attendeeProp)
+ if attendeeProp is not None:
+ print("Before", attendeeProp)
+ attendeeProp.setParameter("PARTSTAT", "NEEDS-ACTION")
+ print("I modified", attendeeProp)
+ result = yield object.setComponent(component)
+ print("Set component result", result)
break
Modified: CalendarServer/trunk/calendarserver/tools/test/test_importer.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_importer.py 2014-11-10 21:34:20 UTC (rev 14151)
+++ CalendarServer/trunk/calendarserver/tools/test/test_importer.py 2014-11-10 21:52:47 UTC (rev 14152)
@@ -148,7 +148,7 @@
"""
-DATA_OTHER_ORGANIZER_EVENT = """BEGIN:VCALENDAR
+DATA_USER02_INVITES_USER01_ORGANIZER_COPY = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
@@ -165,12 +165,12 @@
ORGANIZER;CN=User 02:urn:x-uid:user02
SEQUENCE:0
SUMMARY:Other organizer
+TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
"""
-# TRANSP:OPAQUE
-DATA_ATTENDEE_EVENT = """BEGIN:VCALENDAR
+DATA_USER02_INVITES_USER01_ATTENDEE_COPY = """BEGIN:VCALENDAR
VERSION:2.0
NAME:I'm an attendee
COLOR:#0000FFFF
@@ -333,11 +333,10 @@
@inlineCallbacks
def test_ImportComponentAttendee(self):
- # Have another principal invite this principal
-
+ # Have user02 invite this user01
yield storeComponentInHomeAndCalendar(
self.store,
- Component.allFromString(DATA_OTHER_ORGANIZER_EVENT),
+ Component.allFromString(DATA_USER02_INVITES_USER01_ORGANIZER_COPY),
"user02",
"calendar",
"invite.ics"
@@ -379,7 +378,7 @@
# When importing the event again, instead trigger a re-invite
# from the organizer
- component = Component.allFromString(DATA_ATTENDEE_EVENT)
+ component = Component.allFromString(DATA_USER02_INVITES_USER01_ATTENDEE_COPY)
yield importCollectionComponent(self.store, component)
yield JobItem.waitEmpty(self.store.newTransaction, reactor, 60)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141110/258a5624/attachment-0001.html>
More information about the calendarserver-changes
mailing list