[CalendarServer-changes] [5313] CalendarServer/branches/users/cdaboo/shared-calendars-5187/ twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 16 06:42:36 PDT 2010
Revision: 5313
http://trac.macosforge.org/projects/calendarserver/changeset/5313
Author: cdaboo at apple.com
Date: 2010-03-16 06:42:36 -0700 (Tue, 16 Mar 2010)
Log Message:
-----------
Minor schema change and proper handling of sharer calendar delete.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/customxml.py
CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/sharing.py
Modified: CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/customxml.py 2010-03-16 01:10:24 UTC (rev 5312)
+++ CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/customxml.py 2010-03-16 13:42:36 UTC (rev 5313)
@@ -763,6 +763,7 @@
name = "invite-notification"
allowed_children = {
+ UID.qname() : (0, 1),
(dav_namespace, "href") : (0, 1),
InviteStatusNoResponse.qname() : (0, 1),
InviteStatusDeleted.qname() : (0, 1),
@@ -836,7 +837,6 @@
allowed_children = {
DTStamp.qname() : (0, None),
- UID.qname() : (0, None),
InviteNotification.qname() : (0, None),
InviteReply.qname() : (0, None),
ResourceUpdateNotification.qname() : (0, None),
Modified: CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/sharing.py 2010-03-16 01:10:24 UTC (rev 5312)
+++ CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/sharing.py 2010-03-16 13:42:36 UTC (rev 5313)
@@ -370,6 +370,13 @@
# Cancel invites
record = self.invitesDB().recordForUserID(userid)
+ # Remove any shared calendar
+ sharee = self.principalForCalendarUserAddress(record.userid)
+ if sharee is None:
+ raise ValueError("sharee is None but userid was valid before")
+ shareeHome = sharee.calendarHome()
+ yield shareeHome.removeShareByUID(request, record.inviteuid)
+
# If current user state is accepted then we send an invite with the new state, otherwise
# we cancel any existing invites for the user
if record and record.state != "ACCEPTED":
@@ -412,8 +419,8 @@
xmltype = customxml.InviteNotification(**typeAttr)
xmldata = customxml.Notification(
customxml.DTStamp.fromString(dateTimeToString(datetime.datetime.now(tz=utc))),
- customxml.UID.fromString(record.inviteuid),
customxml.InviteNotification(
+ customxml.UID.fromString(record.inviteuid),
davxml.HRef.fromString(record.userid),
inviteStatusMapToXML[record.state](),
customxml.InviteAccess(inviteAccessMapToXML[record.access]()),
@@ -514,7 +521,7 @@
return self.upgradeToShare(request)
else:
return succeed(True)
- return fail()
+ raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Cannot upgrade to shared calendar"))
@inlineCallbacks
def _processInviteDoc(_, request):
@@ -812,6 +819,11 @@
""" Remove a shared calendar named in resourceName """
return self.declineShare(request, share.hosturl, share.inviteuid)
+ def removeShareByUID(self, request, inviteuid):
+ """ Remove a shared calendar named in resourceName """
+ share = self.sharesDB().recordForInviteUID(inviteuid)
+ return self.removeShare(request, share) if share else succeed(None)
+
@updateCacheTokenOnCallback
def declineShare(self, request, hostUrl, inviteUID):
@@ -854,7 +866,6 @@
xmltype = customxml.InviteReply()
xmldata = customxml.Notification(
customxml.DTStamp.fromString(dateTimeToString(datetime.datetime.now(tz=utc))),
- customxml.UID.fromString(notificationUID),
customxml.InviteReply(
*(
(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100316/ce333602/attachment.html>
More information about the calendarserver-changes
mailing list