<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12049] CalendarServer/branches/users/sagen/groupcacher</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12049">12049</a></dd>
<dt>Author</dt> <dd>gaya@apple.com</dd>
<dt>Date</dt> <dd>2013-12-09 20:49:05 -0800 (Mon, 09 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>More group attendee tests</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagengroupcachertwextwhogroupspy">CalendarServer/branches/users/sagen/groupcacher/twext/who/groups.py</a></li>
<li><a href="#CalendarServerbranchesuserssagengroupcachertwextwhotesttest_groupspy">CalendarServer/branches/users/sagen/groupcacher/twext/who/test/test_groups.py</a></li>
<li><a href="#CalendarServerbranchesuserssagengroupcachertwistedcaldavicalpy">CalendarServer/branches/users/sagen/groupcacher/twistedcaldav/ical.py</a></li>
<li><a href="#CalendarServerbranchesuserssagengroupcachertxdavcaldavdatastoresqlpy">CalendarServer/branches/users/sagen/groupcacher/txdav/caldav/datastore/sql.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagengroupcachertwextwhogroupspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/groupcacher/twext/who/groups.py (12048 => 12049)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/groupcacher/twext/who/groups.py        2013-12-09 23:56:05 UTC (rev 12048)
+++ CalendarServer/branches/users/sagen/groupcacher/twext/who/groups.py        2013-12-10 04:49:05 UTC (rev 12049)
</span><span class="lines">@@ -156,10 +156,10 @@
</span><span class="cx"> From=groupMemember,
</span><span class="cx"> Where=groupMemember.GROUP_ID == self.groupID,
</span><span class="cx"> ).on(self.transaction)
</span><del>- individualGUIDs = [row[0] for row in rows]
</del><ins>+ memberGUIDs = [row[0] for row in rows]
</ins><span class="cx">
</span><span class="cx"> component = yield calendarObject.component()
</span><del>- changed = component.expandGroupAttendee(self.groupGUID, individualGUIDs, self.directoryService().recordWithCalendarUserAddress)
</del><ins>+ changed = component.expandGroupAttendee(self.groupGUID, memberGUIDs, self.directoryService().recordWithCalendarUserAddress)
</ins><span class="cx">
</span><span class="cx"> if changed:
</span><span class="cx"> yield calendarObject.setComponent(component)
</span><span class="lines">@@ -181,7 +181,8 @@
</span><span class="cx"> records.add(record)
</span><span class="cx"> for member in (yield record.members()):
</span><span class="cx"> if member not in records:
</span><del>- if member.recordType != RecordType.group:
</del><ins>+ #TODO: HACK for old-style XML. FIX
+ if member.recordType != RecordType.group and str(member.recordType) != "groups":
</ins><span class="cx"> members.add(member)
</span><span class="cx"> yield expandedMembers(member, members, records)
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagengroupcachertwextwhotesttest_groupspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/groupcacher/twext/who/test/test_groups.py (12048 => 12049)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/groupcacher/twext/who/test/test_groups.py        2013-12-09 23:56:05 UTC (rev 12048)
+++ CalendarServer/branches/users/sagen/groupcacher/twext/who/test/test_groups.py        2013-12-10 04:49:05 UTC (rev 12049)
</span><span class="lines">@@ -18,13 +18,20 @@
</span><span class="cx"> Group membership caching implementation tests
</span><span class="cx"> """
</span><span class="cx">
</span><ins>+from calendarserver.tap.util import directoryFromConfig
</ins><span class="cx"> from twext.who.groups import GroupCacher, expandedMembers
</span><span class="cx"> from twext.who.idirectory import RecordType
</span><span class="cx"> from twext.who.test.test_xml import xmlService
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks
</span><ins>+from twisted.trial import unittest
+from twistedcaldav.config import config
+from twistedcaldav.ical import Component, normalize_iCalStr
</ins><span class="cx"> from twistedcaldav.test.util import StoreTestCase
</span><ins>+from txdav.caldav.datastore.test.util import buildCalendarStore, \
+ populateCalendarsFrom, CommonCommonTests
</ins><span class="cx"> from txdav.common.icommondatastore import NotFoundError
</span><span class="cx"> from uuid import UUID
</span><ins>+import os
</ins><span class="cx">
</span><span class="cx"> class GroupCacherTest(StoreTestCase):
</span><span class="cx">
</span><span class="lines">@@ -234,18 +241,6 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx">
</span><del>-
-from twisted.trial import unittest
-from twistedcaldav.config import config
-from twistedcaldav.ical import Component, normalize_iCalStr
-
-from txdav.caldav.datastore.test.util import buildCalendarStore
-from txdav.common.datastore.test.util import populateCalendarsFrom, \
- CommonCommonTests
-
-import os
-from calendarserver.tap.util import directoryFromConfig
-
</del><span class="cx"> class GroupAttendeeReconciliation(CommonCommonTests, unittest.TestCase):
</span><span class="cx"> """
</span><span class="cx"> GroupAttendeeReconciliation tests
</span><span class="lines">@@ -253,9 +248,11 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def setUp(self):
</span><del>- config.Scheduling.Options.AllowGroupAsAttendee = True
</del><ins>+ self.patch(config.Scheduling.Options, "AllowGroupAsAttendee", "True")
</ins><span class="cx">
</span><span class="cx"> yield super(GroupAttendeeReconciliation, self).setUp()
</span><ins>+ self.xmlService = xmlService(self.mktemp(), xmlData=testXMLConfig)
+
</ins><span class="cx"> self.patch(config.DirectoryService.params, "xmlFile",
</span><span class="cx"> os.path.join(
</span><span class="cx"> os.path.dirname(__file__), "accounts", "accounts.xml"
</span><span class="lines">@@ -297,7 +294,7 @@
</span><span class="cx"> """
</span><span class="cx"> calendar = yield self.calendarUnderTest(name="calendar", home="user01")
</span><span class="cx">
</span><del>- data_put_2 = """BEGIN:VCALENDAR
</del><ins>+ data_put_1 = """BEGIN:VCALENDAR
</ins><span class="cx"> CALSCALE:GREGORIAN
</span><span class="cx"> PRODID:-//Example Inc.//Example Calendar//EN
</span><span class="cx"> VERSION:2.0
</span><span class="lines">@@ -306,20 +303,20 @@
</span><span class="cx"> CREATED:20060101T150000Z
</span><span class="cx"> DTSTART;TZID=US/Eastern:20140101T100000
</span><span class="cx"> DURATION:PT1H
</span><del>-SUMMARY:event 2
-UID:event2@ninevah.local
</del><ins>+SUMMARY:event 1
+UID:event1@ninevah.local
</ins><span class="cx"> ORGANIZER:MAILTO:user01@example.com
</span><span class="cx"> ATTENDEE:mailto:user01@example.com
</span><span class="cx"> ATTENDEE:MAILTO:group02@example.com
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR"""
</span><span class="cx">
</span><del>- data_get_2 = """BEGIN:VCALENDAR
</del><ins>+ data_get_1 = """BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> CALSCALE:GREGORIAN
</span><span class="cx"> PRODID:-//Example Inc.//Example Calendar//EN
</span><span class="cx"> BEGIN:VEVENT
</span><del>-UID:event2@ninevah.local
</del><ins>+UID:event1@ninevah.local
</ins><span class="cx"> DTSTART;TZID=US/Eastern:20140101T100000
</span><span class="cx"> DURATION:PT1H
</span><span class="cx"> ATTENDEE;CN=User 01;EMAIL=user01@example.com;RSVP=TRUE:urn:uuid:user01
</span><span class="lines">@@ -328,28 +325,28 @@
</span><span class="cx"> ATTENDEE;CN=User 07;EMAIL=user07@example.com;MEMBER="urn:uuid:group02";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user07
</span><span class="cx"> CREATED:20060101T150000Z
</span><span class="cx"> ORGANIZER;CN=User 01;EMAIL=user01@example.com:urn:uuid:user01
</span><del>-SUMMARY:event 2
</del><ins>+SUMMARY:event 1
</ins><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """
</span><span class="cx">
</span><del>- vcalendar2 = Component.fromString(data_put_2)
- cobj2 = yield calendar.createCalendarObjectWithName("data2.ics", vcalendar2)
</del><ins>+ vcalendar1 = Component.fromString(data_put_1)
+ cobj1 = yield calendar.createCalendarObjectWithName("data1.ics", vcalendar1)
</ins><span class="cx"> yield self.commit()
</span><span class="cx">
</span><del>- cobj2 = yield self.calendarObjectUnderTest(name="data2.ics", calendar_name="calendar", home="user01")
- vcalendar2 = yield cobj2.component()
- self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_2))
</del><ins>+ cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="user01")
+ vcalendar2 = yield cobj1.component()
+ self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_unknownPUT(self):
</span><span class="cx"> """
</span><del>- Test that group attendee is expanded on PUT
</del><ins>+ Test unknown group with CUTYPE=GROUP handled
</ins><span class="cx"> """
</span><span class="cx"> calendar = yield self.calendarUnderTest(name="calendar", home="user01")
</span><span class="cx">
</span><del>- data_put_2 = """BEGIN:VCALENDAR
</del><ins>+ data_put_1 = """BEGIN:VCALENDAR
</ins><span class="cx"> CALSCALE:GREGORIAN
</span><span class="cx"> PRODID:-//Example Inc.//Example Calendar//EN
</span><span class="cx"> VERSION:2.0
</span><span class="lines">@@ -358,38 +355,38 @@
</span><span class="cx"> CREATED:20060101T150000Z
</span><span class="cx"> DTSTART;TZID=US/Eastern:20140101T100000
</span><span class="cx"> DURATION:PT1H
</span><del>-SUMMARY:event 2
-UID:event2@ninevah.local
</del><ins>+SUMMARY:event 1
+UID:event1@ninevah.local
</ins><span class="cx"> ORGANIZER:MAILTO:user01@example.com
</span><span class="cx"> ATTENDEE:mailto:user01@example.com
</span><span class="cx"> ATTENDEE;CUTYPE=GROUP:urn:uuid:groupUnknown
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR"""
</span><span class="cx">
</span><del>- data_get_2 = """BEGIN:VCALENDAR
</del><ins>+ data_get_1 = """BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> CALSCALE:GREGORIAN
</span><span class="cx"> PRODID:-//Example Inc.//Example Calendar//EN
</span><span class="cx"> BEGIN:VEVENT
</span><del>-UID:event2@ninevah.local
</del><ins>+UID:event1@ninevah.local
</ins><span class="cx"> DTSTART;TZID=US/Eastern:20140101T100000
</span><span class="cx"> DURATION:PT1H
</span><span class="cx"> ATTENDEE;CN=User 01;EMAIL=user01@example.com;RSVP=TRUE:urn:uuid:user01
</span><span class="cx"> ATTENDEE;CUTYPE=GROUP;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:uuid:groupUnknown
</span><span class="cx"> CREATED:20060101T150000Z
</span><span class="cx"> ORGANIZER;CN=User 01;EMAIL=user01@example.com:urn:uuid:user01
</span><del>-SUMMARY:event 2
</del><ins>+SUMMARY:event 1
</ins><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """
</span><span class="cx">
</span><del>- vcalendar2 = Component.fromString(data_put_2)
- cobj2 = yield calendar.createCalendarObjectWithName("data2.ics", vcalendar2)
</del><ins>+ vcalendar1 = Component.fromString(data_put_1)
+ cobj1 = yield calendar.createCalendarObjectWithName("data1.ics", vcalendar1)
</ins><span class="cx"> yield self.commit()
</span><span class="cx">
</span><del>- cobj2 = yield self.calendarObjectUnderTest(name="data2.ics", calendar_name="calendar", home="user01")
- vcalendar2 = yield cobj2.component()
- self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_2))
</del><ins>+ cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="user01")
+ vcalendar2 = yield cobj1.component()
+ self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -441,3 +438,115 @@
</span><span class="cx"> cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="user01")
</span><span class="cx"> vcalendar1 = yield cobj1.component()
</span><span class="cx"> self.assertEqual(normalize_iCalStr(vcalendar1), normalize_iCalStr(data_get_1))
</span><ins>+
+
+ @inlineCallbacks
+ def test_nestedPUT(self):
+ """
+ Test that nested groups are expanded expanded on PUT
+ """
+ calendar = yield self.calendarUnderTest(name="calendar", home="user01")
+
+ data_put_1 = """BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+VERSION:2.0
+BEGIN:VEVENT
+DTSTAMP:20051222T205953Z
+CREATED:20060101T150000Z
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+SUMMARY:event 1
+UID:event1@ninevah.local
+ORGANIZER:MAILTO:user01@example.com
+ATTENDEE:mailto:user01@example.com
+ATTENDEE:urn:uuid:group04
+END:VEVENT
+END:VCALENDAR"""
+
+ data_get_1 = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+BEGIN:VEVENT
+UID:event1@ninevah.local
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+ATTENDEE;CN=User 01;EMAIL=user01@example.com;RSVP=TRUE:urn:uuid:user01
+ATTENDEE;CN=Group 04;CUTYPE=GROUP;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:uuid:group04
+ATTENDEE;CN=User 06;EMAIL=user06@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user06
+ATTENDEE;CN=User 07;EMAIL=user07@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user07
+ATTENDEE;CN=User 08;EMAIL=user08@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user08
+ATTENDEE;CN=User 09;EMAIL=user09@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user09
+ATTENDEE;CN=User 10;EMAIL=user10@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user10
+CREATED:20060101T150000Z
+ORGANIZER;CN=User 01;EMAIL=user01@example.com:urn:uuid:user01
+SUMMARY:event 1
+END:VEVENT
+END:VCALENDAR
+"""
+
+ vcalendar1 = Component.fromString(data_put_1)
+ cobj1 = yield calendar.createCalendarObjectWithName("data1.ics", vcalendar1)
+ yield self.commit()
+
+ cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="user01")
+ vcalendar2 = yield cobj1.component()
+ self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
+
+
+ @inlineCallbacks
+ def test_twoGroupPUT(self):
+ """
+ Test that expanded users in two primary groups have groups in MEMBERS param
+ """
+ calendar = yield self.calendarUnderTest(name="calendar", home="user01")
+
+ data_put_1 = """BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+VERSION:2.0
+BEGIN:VEVENT
+DTSTAMP:20051222T205953Z
+CREATED:20060101T150000Z
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+SUMMARY:event 1
+UID:event1@ninevah.local
+ORGANIZER:MAILTO:user01@example.com
+ATTENDEE:mailto:user01@example.com
+ATTENDEE:MAILTO:group02@example.com
+ATTENDEE:urn:uuid:group04
+END:VEVENT
+END:VCALENDAR"""
+
+ data_get_1 = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+BEGIN:VEVENT
+UID:event1@ninevah.local
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+ATTENDEE;CN=User 01;EMAIL=user01@example.com;RSVP=TRUE:urn:uuid:user01
+ATTENDEE;CN=Group 02;CUTYPE=GROUP;EMAIL=group02@example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:uuid:group02
+ATTENDEE;CN=Group 04;CUTYPE=GROUP;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:uuid:group04
+ATTENDEE;CN=User 06;EMAIL=user06@example.com;MEMBER="urn:uuid:group04","urn:uuid:group02";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user06
+ATTENDEE;CN=User 07;EMAIL=user07@example.com;MEMBER="urn:uuid:group04","urn:uuid:group02";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user07
+ATTENDEE;CN=User 08;EMAIL=user08@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user08
+ATTENDEE;CN=User 09;EMAIL=user09@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user09
+ATTENDEE;CN=User 10;EMAIL=user10@example.com;MEMBER="urn:uuid:group04";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:uuid:user10
+CREATED:20060101T150000Z
+ORGANIZER;CN=User 01;EMAIL=user01@example.com:urn:uuid:user01
+SUMMARY:event 1
+END:VEVENT
+END:VCALENDAR
+"""
+
+ vcalendar1 = Component.fromString(data_put_1)
+ cobj1 = yield calendar.createCalendarObjectWithName("data1.ics", vcalendar1)
+ yield self.commit()
+
+ cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="user01")
+ vcalendar2 = yield cobj1.component()
+ self.assertEqual(normalize_iCalStr(vcalendar2), normalize_iCalStr(data_get_1))
</ins></span></pre></div>
<a id="CalendarServerbranchesuserssagengroupcachertwistedcaldavicalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/groupcacher/twistedcaldav/ical.py (12048 => 12049)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/groupcacher/twistedcaldav/ical.py        2013-12-09 23:56:05 UTC (rev 12048)
+++ CalendarServer/branches/users/sagen/groupcacher/twistedcaldav/ical.py        2013-12-10 04:49:05 UTC (rev 12049)
</span><span class="lines">@@ -3355,21 +3355,21 @@
</span><span class="cx"> component.normalizeCalendarUserAddresses(lookupFunction, principalFunction, toUUID)
</span><span class="cx">
</span><span class="cx">
</span><del>- def expandGroupAttendee(self, groupGUID, individualGUIDs, principalFunction):
</del><ins>+ def expandGroupAttendee(self, groupGUID, memberGUIDs, principalFunction):
</ins><span class="cx">
</span><del>- individualUUIDs = set(["urn:uuid:" + individualGUID for individualGUID in individualGUIDs])
</del><ins>+ memberUUIDs = set(["urn:uuid:" + memberGUID for memberGUID in memberGUIDs])
</ins><span class="cx"> groupUUID = "urn:uuid:" + groupGUID
</span><span class="cx"> changed = False
</span><span class="cx"> for component in self.subcomponents():
</span><span class="cx"> if component.name() in ignoredComponents:
</span><span class="cx"> continue
</span><span class="cx">
</span><del>- oldAttendeeProps = component.properties("ATTENDEE")
</del><ins>+ oldAttendeeProps = tuple(component.properties("ATTENDEE"))
</ins><span class="cx"> oldAttendeeUUIDs = set([attendeeProp.value() for attendeeProp in oldAttendeeProps])
</span><span class="cx">
</span><span class="cx"> # add new member attendees
</span><del>- for individualUUID in individualUUIDs - oldAttendeeUUIDs:
- directoryRecord = principalFunction(individualUUID)
</del><ins>+ for memberUUID in memberUUIDs - oldAttendeeUUIDs:
+ directoryRecord = principalFunction(memberUUID)
</ins><span class="cx"> newAttendeeProp = directoryRecord.attendee(params={"MEMBER": groupUUID})
</span><span class="cx"> component.addProperty(newAttendeeProp)
</span><span class="cx"> changed = True
</span><span class="lines">@@ -3377,16 +3377,16 @@
</span><span class="cx"> # remove attendee or update MEMBER attribute for non-primary attendees in this group,
</span><span class="cx"> for attendeeProp in oldAttendeeProps:
</span><span class="cx"> if attendeeProp.hasParameter("MEMBER"):
</span><del>- parameterValues = attendeeProp.parameterValues("MEMBER")
</del><ins>+ parameterValues = tuple(attendeeProp.parameterValues("MEMBER"))
</ins><span class="cx"> if groupUUID in parameterValues:
</span><del>- if attendeeProp.value() not in individualUUIDs:
</del><ins>+ if attendeeProp.value() not in memberUUIDs:
</ins><span class="cx"> attendeeProp.removeParameterValue("MEMBER", groupUUID)
</span><span class="cx"> if not attendeeProp.parameterValues("MEMBER"):
</span><span class="cx"> component.removeProperty(attendeeProp)
</span><span class="cx"> changed = True
</span><span class="cx"> else:
</span><del>- if attendeeProp.value() in individualUUIDs:
- attendeeProp.setParameter("MEMBER", parameterValues + [groupUUID, ])
</del><ins>+ if attendeeProp.value() in memberUUIDs:
+ attendeeProp.setParameter("MEMBER", parameterValues + tuple([groupUUID, ]))
</ins><span class="cx"> changed = True
</span><span class="cx"> return changed
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagengroupcachertxdavcaldavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/groupcacher/txdav/caldav/datastore/sql.py (12048 => 12049)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/groupcacher/txdav/caldav/datastore/sql.py        2013-12-09 23:56:05 UTC (rev 12048)
+++ CalendarServer/branches/users/sagen/groupcacher/txdav/caldav/datastore/sql.py        2013-12-10 04:49:05 UTC (rev 12049)
</span><span class="lines">@@ -1627,9 +1627,9 @@
</span><span class="cx"> members = yield expandedMembers(groupRecord)
</span><span class="cx"> membershipHashContent = hashlib.md5()
</span><span class="cx"> members = yield expandedMembers(groupRecord)
</span><del>- individualGUIDs = sorted([member.guid for member in members])
- for individualGUID in individualGUIDs:
- membershipHashContent.update(str(individualGUID))
</del><ins>+ memberGUIDs = sorted([member.guid for member in members])
+ for memberGUID in memberGUIDs:
+ membershipHashContent.update(str(memberGUID))
</ins><span class="cx"> membershipHash = membershipHashContent.hexdigest()
</span><span class="cx">
</span><span class="cx"> # associate group ID with self
</span><span class="lines">@@ -1645,7 +1645,7 @@
</span><span class="cx"> pass
</span><span class="cx">
</span><span class="cx"> # get members
</span><del>- component.expandGroupAttendee(groupGUID, individualGUIDs, self.directoryService().recordWithCalendarUserAddress)
</del><ins>+ component.expandGroupAttendee(groupGUID, memberGUIDs, self.directoryService().recordWithCalendarUserAddress)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def validCalendarDataCheck(self, component, inserting): #@UnusedVariable
</span></span></pre>
</div>
</div>
</body>
</html>