[CalendarServer-changes] [8121] CalendarServer/trunk/twistedcaldav/upgrade.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 26 17:50:05 PDT 2011
Revision: 8121
http://trac.macosforge.org/projects/calendarserver/changeset/8121
Author: sagen at apple.com
Date: 2011-09-26 17:50:03 -0700 (Mon, 26 Sep 2011)
Log Message:
-----------
Detect inbox items missing main component; remove inbox items even if we can't process them.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/upgrade.py
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2011-09-26 19:44:23 UTC (rev 8120)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2011-09-27 00:50:03 UTC (rev 8121)
@@ -984,21 +984,23 @@
request.path = uri
request._rememberResource(inboxItemResource, uri)
- yield self.processInboxItem(
- root,
- directory,
- principal,
- request,
- inbox,
- inboxItemResource,
- uuid,
- uri
- )
+ try:
+ yield self.processInboxItem(
+ root,
+ directory,
+ principal,
+ request,
+ inbox,
+ inboxItemResource,
+ uuid,
+ uri
+ )
+ except Exception, e:
+ log.error("Error processing inbox item: %s (%s)"
+ % (inboxItem, e))
+
inboxItems.remove(inboxItem)
- except Exception, e:
- log.error("Error processing inbox item: %s (%s)" % (inboxItem, e))
- log.error("Restart calendar service to reattempt processing")
finally:
# Rewrite the inbox items file in case we exit before we're
@@ -1008,6 +1010,7 @@
for inboxItem in inboxItems:
output.write("%s\n" % (inboxItem,))
os.rename(inboxItemsList + ".tmp", inboxItemsList)
+ log.error("Restart calendar service to reattempt processing")
else:
os.remove(inboxItemsList)
@@ -1030,29 +1033,33 @@
inbox, ownerPrincipal.scheduleInboxURL())
calendar = yield inboxItem.iCalendar()
- try:
- method = calendar.propertyValue("METHOD")
- except ValueError:
- returnValue(None)
+ if calendar.mainType() is not None:
+ try:
+ method = calendar.propertyValue("METHOD")
+ except ValueError:
+ returnValue(None)
- if method == "REPLY":
- # originator is attendee sending reply
- originator = calendar.getAttendees()[0]
+ if method == "REPLY":
+ # originator is attendee sending reply
+ originator = calendar.getAttendees()[0]
+ else:
+ # originator is the organizer
+ originator = calendar.getOrganizer()
+
+ principalCollection = directory.principalCollection
+ originatorPrincipal = principalCollection.principalForCalendarUserAddress(originator)
+ originator = LocalCalendarUser(originator, originatorPrincipal)
+ recipients = (owner,)
+
+ scheduler = DirectScheduler(request, inboxItem)
+ # Process inbox item
+ yield scheduler.doSchedulingViaPUT(originator, recipients, calendar,
+ internal_request=False)
else:
- # originator is the organizer
- originator = calendar.getOrganizer()
+ log.warn("Removing invalid inbox item: %s" % (uri,))
- principalCollection = directory.principalCollection
- originatorPrincipal = principalCollection.principalForCalendarUserAddress(originator)
- originator = LocalCalendarUser(originator, originatorPrincipal)
- recipients = (owner,)
-
+ # Remove item
txn = request._newStoreTransaction
- scheduler = DirectScheduler(request, inboxItem)
- # Process inbox item
- yield scheduler.doSchedulingViaPUT(originator, recipients, calendar,
- internal_request=False)
- # Remove item
yield inboxItem.storeRemove(request, True, uri)
yield txn.commit()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110926/e73fa143/attachment.html>
More information about the calendarserver-changes
mailing list