[CalendarServer-changes] [1637]
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jul 2 14:06:48 PDT 2007
Revision: 1637
http://trac.macosforge.org/projects/calendarserver/changeset/1637
Author: cdaboo at apple.com
Date: 2007-07-02 14:06:47 -0700 (Mon, 02 Jul 2007)
Log Message:
-----------
Make sure auto-replied requests are deleted from the Inbox after processing. CALDAV:schedule-state property removed
as its no longer in the spec.
Modified Paths:
--------------
CalDAVTester/trunk/Resource/schedule/12.xml
CalDAVTester/trunk/Resource/schedulenormal/3.xml
CalDAVTester/trunk/scripts/tests/schedulepost.xml
CalDAVTester/trunk/scripts/tests/schedulepostauto.xml
CalDAVTester/trunk/scripts/tests/schedulepostnormal.xml
CalendarServer/trunk/twistedcaldav/caldavxml.py
CalendarServer/trunk/twistedcaldav/itip.py
CalendarServer/trunk/twistedcaldav/schedule.py
Modified: CalDAVTester/trunk/Resource/schedule/12.xml
===================================================================
--- CalDAVTester/trunk/Resource/schedule/12.xml 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalDAVTester/trunk/Resource/schedule/12.xml 2007-07-02 21:06:47 UTC (rev 1637)
@@ -3,6 +3,5 @@
<D:prop>
<C:originator/>
<C:recipient/>
-<C:schedule-state/>
</D:prop>
</D:propfind>
Modified: CalDAVTester/trunk/Resource/schedulenormal/3.xml
===================================================================
--- CalDAVTester/trunk/Resource/schedulenormal/3.xml 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalDAVTester/trunk/Resource/schedulenormal/3.xml 2007-07-02 21:06:47 UTC (rev 1637)
@@ -3,6 +3,5 @@
<D:prop>
<C:originator/>
<C:recipient/>
-<C:schedule-state/>
</D:prop>
</D:propfind>
Modified: CalDAVTester/trunk/scripts/tests/schedulepost.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/schedulepost.xml 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalDAVTester/trunk/scripts/tests/schedulepost.xml 2007-07-02 21:06:47 UTC (rev 1637)
@@ -443,7 +443,6 @@
<name>okprops</name>
<value>urn:ietf:params:xml:ns:caldavoriginator$<href xmlns="DAV:">$cuaddr1:</href></value>
<value>urn:ietf:params:xml:ns:caldavrecipient$<href xmlns="DAV:">$cuaddr2:</href></value>
- <value>urn:ietf:params:xml:ns:caldavschedule-state$<not-processed/></value>
</arg>
</verify>
</request>
@@ -471,7 +470,6 @@
<name>okprops</name>
<value>urn:ietf:params:xml:ns:caldavoriginator$<href xmlns="DAV:">$cuaddr1:</href></value>
<value>urn:ietf:params:xml:ns:caldavrecipient$<href xmlns="DAV:">$cuaddr3:</href></value>
- <value>urn:ietf:params:xml:ns:caldavschedule-state$<not-processed/></value>
</arg>
</verify>
</request>
Modified: CalDAVTester/trunk/scripts/tests/schedulepostauto.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/schedulepostauto.xml 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalDAVTester/trunk/scripts/tests/schedulepostauto.xml 2007-07-02 21:06:47 UTC (rev 1637)
@@ -114,15 +114,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/1.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -235,15 +239,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/4.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -298,24 +306,6 @@
</verify>
</request>
</test>
- <test name='8' ignore='no'>
- <description>One item in resource01 Inbox (old one deleted)</description>
- <request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>PROPFIND</method>
- <ruri>$rpathprefix1:/$inbox:/</ruri>
- <data>
- <content-type>text/xml; charset=utf-8</content-type>
- <filepath>Resource/scheduleauto/6.xml</filepath>
- </data>
- <verify>
- <callback>multistatusItems</callback>
- <arg>
- <name>count</name>
- <value>1</value>
- </arg>
- </verify>
- </request>
- </test>
</test-suite>
<test-suite name='Repeat request - no auto-reply' ignore='no'>
@@ -386,15 +376,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/4.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -449,24 +443,6 @@
</verify>
</request>
</test>
- <test name='8' ignore='no'>
- <description>One item in resource01 Inbox (old one deleted)</description>
- <request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>PROPFIND</method>
- <ruri>$rpathprefix1:/$inbox:/</ruri>
- <data>
- <content-type>text/xml; charset=utf-8</content-type>
- <filepath>Resource/scheduleauto/6.xml</filepath>
- </data>
- <verify>
- <callback>multistatusItems</callback>
- <arg>
- <name>count</name>
- <value>1</value>
- </arg>
- </verify>
- </request>
- </test>
</test-suite>
<test-suite name='POST non-recurring with conflict' ignore='no'>
@@ -529,15 +505,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/7.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -654,15 +634,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/9.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -779,15 +763,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/11.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -900,15 +888,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/14.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -1025,15 +1017,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/16.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
@@ -1150,15 +1146,19 @@
</request>
</test>
<test name='4' ignore='no'>
- <description>One item in resource01 Inbox</description>
+ <description>No items in resource01 Inbox</description>
<request user="$useradmin:" pswd="$pswdadmin:" print-response="no">
- <method>GETNEW</method>
+ <method>PROPFIND</method>
<ruri>$rpathprefix1:/$inbox:/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/scheduleauto/6.xml</filepath>
+ </data>
<verify>
- <callback>dataMatch</callback>
+ <callback>multistatusItems</callback>
<arg>
- <name>filepath</name>
- <value>Resource/scheduleauto/18.ics</value>
+ <name>count</name>
+ <value>0</value>
</arg>
</verify>
</request>
Modified: CalDAVTester/trunk/scripts/tests/schedulepostnormal.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/schedulepostnormal.xml 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalDAVTester/trunk/scripts/tests/schedulepostnormal.xml 2007-07-02 21:06:47 UTC (rev 1637)
@@ -122,7 +122,6 @@
<name>okprops</name>
<value>urn:ietf:params:xml:ns:caldavoriginator$<href xmlns="DAV:">$principal:</href></value>
<value>urn:ietf:params:xml:ns:caldavrecipient$<href xmlns="DAV:">$principal2:</href></value>
- <value>urn:ietf:params:xml:ns:caldavschedule-state$<not-processed/></value>
</arg>
</verify>
</request>
@@ -150,7 +149,6 @@
<name>okprops</name>
<value>urn:ietf:params:xml:ns:caldavoriginator$<href xmlns="DAV:">$principal:</href></value>
<value>urn:ietf:params:xml:ns:caldavrecipient$<href xmlns="DAV:">$principal3:</href></value>
- <value>urn:ietf:params:xml:ns:caldavschedule-state$<not-processed/></value>
</arg>
</verify>
</request>
Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py 2007-07-02 21:06:47 UTC (rev 1637)
@@ -1443,34 +1443,6 @@
allowed_children = { (davxml.dav_namespace, "href"): (0, None) } # NB Minimum is zero because this is a property name
-class ScheduleState (CalDAVElement):
- """
- A property on a schedule message in a schedule Inbox that indicates whether processing has taken place.
- (CalDAV-schedule, section x.x.x)
- """
- name = "schedule-state"
- hidden = True
- protected = True
-
- allowed_children = {
- (caldav_namespace, "processed"): (0, 1),
- (caldav_namespace, "not-processed"): (0, 1)
- }
-
-class Processed (CalDAVEmptyElement):
- """
- Indicates that a schedule message in a schedule Inbox has been processed.
- (CalDAV-schedule, section x.x.x)
- """
- name = "processed"
-
-class NotProcessed (CalDAVEmptyElement):
- """
- Indicates that a schedule message in a schedule Inbox has not been processed.
- (CalDAV-schedule, section x.x.x)
- """
- name = "not-processed"
-
class ScheduleInbox (CalDAVEmptyElement):
"""
Denotes the resource type of a calendar schedule Inbox.
Modified: CalendarServer/trunk/twistedcaldav/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/itip.py 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalendarServer/trunk/twistedcaldav/itip.py 2007-07-02 21:06:47 UTC (rev 1637)
@@ -104,6 +104,7 @@
2. add to f-b-s calendar
2. If not,
1. remove the one we got - its 'stale'
+ 3. Delete the request from the Inbox.
@param request: the L{twisted.web2.server.Request} for the current request.
@param principal: the L{CalendarPrincipalFile} principal resource for the principal we are dealing with.
@@ -246,9 +247,15 @@
newchild = newchild.getResult()
newInboxResource(child, newchild)
- # Store CALDAV:schedule-state property
- assert child.fp.exists()
- child.writeDeadProperty(caldavxml.ScheduleState(caldavxml.Processed()))
+ # Remove the now processed incoming request.
+ try:
+ d = waitForDeferred(deleteResource(inbox, child.fp.basename()))
+ yield d
+ d.getResult()
+ logging.info("[ITIP]: deleted new iTIP message %s in Inbox because it has been processed." % (child.fp.basename(),))
+ except:
+ log.err("Error while auto-processing iTIP: %s" % (failure.Failure(),))
+ raise iTipException
yield None
return
else:
@@ -286,6 +293,7 @@
2. Remove existing ones in Inbox.
3. See if this updates existing ones in free-busy-set calendars.
4. Remove existing ones in those calendars.
+ 5. Remove the incoming request.
NB Removal can be complex as we need to take RECURRENCE-ID into account - i.e a single
instance may be cancelled. What we need to do for this is:
@@ -383,7 +391,7 @@
cal = updatecal.iCalendar(calmatch[0])
info = getSyncInfo(calmatch[0], cal)
if compareSyncInfo(info, newinfo) < 0:
- # Re-write existing resource with new one
+ # Delete existing resource which has been cancelled
try:
d = waitForDeferred(deleteResource(updatecal, calmatch[0],))
yield d
@@ -408,13 +416,15 @@
# Nothing to do
pass
- # If we get here we have a new iTIP message that we want to process. Any previous ones
- # have been removed (so we won't run in to problems when we check that there is free time
- # to book the new one).
-
- # Store CALDAV:schedule-state property
- assert child.fp.exists()
- child.writeDeadProperty(caldavxml.ScheduleState(caldavxml.Processed()))
+ # Remove the now processed incoming request.
+ try:
+ d = waitForDeferred(deleteResource(inbox, child.fp.basename()))
+ yield d
+ d.getResult()
+ logging.info("[ITIP]: deleted new iTIP message %s in Inbox because it has been processed." % (child.fp.basename(),))
+ except:
+ log.err("Error while auto-processing iTIP: %s" % (failure.Failure(),))
+ raise iTipException
yield None
return
else:
@@ -631,7 +641,7 @@
def newInboxResource(child, newchild):
"""
- Copy recipient and orgnaizer properties from one iTIP resource, to another,
+ Copy recipient and organizer properties from one iTIP resource, to another,
switching them as appropriate for a reply, and also set the state.
@param child: the L{CalDAVFile} for the original iTIP message.
@@ -650,9 +660,6 @@
if orig.children:
# Store CALDAV:originator property
newchild.writeDeadProperty(caldavxml.Recipient(davxml.HRef.fromString(str(orig.children[0]))))
-
- # Store CALDAV:schedule-state property
- newchild.writeDeadProperty(caldavxml.ScheduleState(caldavxml.NotProcessed()))
def deleteResource(collection, name):
"""
Modified: CalendarServer/trunk/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/schedule.py 2007-07-02 20:31:24 UTC (rev 1636)
+++ CalendarServer/trunk/twistedcaldav/schedule.py 2007-07-02 21:06:47 UTC (rev 1637)
@@ -477,9 +477,6 @@
# Store CALDAV:recipient property
child.writeDeadProperty(caldavxml.Recipient(davxml.HRef(recipient)))
- # Store CALDAV:schedule-state property
- child.writeDeadProperty(caldavxml.ScheduleState(caldavxml.NotProcessed()))
-
# Look for auto-schedule option
if principal.autoSchedule():
autoresponses.append((principal, inbox, child))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070702/f1c97dd1/attachment.html
More information about the calendarserver-changes
mailing list