[CalendarServer-changes] [8860] CalendarServer/trunk/calendarserver/tools/shell/vfs.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 13 18:26:13 PDT 2012
Revision: 8860
http://trac.macosforge.org/projects/calendarserver/changeset/8860
Author: wsanchez at apple.com
Date: 2012-03-13 18:26:13 -0700 (Tue, 13 Mar 2012)
Log Message:
-----------
Avoid blowing up on error fetching mainComponent
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/shell/vfs.py
Modified: CalendarServer/trunk/calendarserver/tools/shell/vfs.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-03-14 00:49:06 UTC (rev 8859)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-03-14 01:26:13 UTC (rev 8860)
@@ -20,12 +20,14 @@
from cStringIO import StringIO
-#from twisted.python import log
+from twisted.python import log
from twisted.internet.defer import succeed
from twisted.internet.defer import inlineCallbacks, returnValue
from txdav.common.icommondatastore import NotFoundError
+from twistedcaldav.ical import InvalidICalendarDataError
+
from calendarserver.tools.tables import Table
@@ -378,8 +380,8 @@
@inlineCallbacks
def _childWithObject(self, object):
- name = (yield object.uid())
- returnValue(CalendarObject(self.service, self.path + (name,), object))
+ uid = (yield object.uid())
+ returnValue(CalendarObject(self.service, self.path + (uid,), object, uid))
@inlineCallbacks
def child(self, name):
@@ -407,23 +409,34 @@
"""
Calendar object.
"""
- def __init__(self, service, path, calendarObject):
+ def __init__(self, service, path, calendarObject, uid):
File.__init__(self, service, path)
self.object = calendarObject
+ self.uid = uid
@inlineCallbacks
def lookup(self):
if not hasattr(self, "component"):
component = (yield self.object.component())
- mainComponent = component.mainComponent()
- self.componentType = mainComponent.name()
- self.uid = mainComponent.propertyValue("UID")
- self.summary = mainComponent.propertyValue("SUMMARY")
- self.mainComponent = mainComponent
- self.component = component
+ try:
+ mainComponent = component.mainComponent()
+ self.componentType = mainComponent.name()
+ #self.uid = mainComponent.propertyValue("UID")
+ self.summary = mainComponent.propertyValue("SUMMARY")
+ self.mainComponent = mainComponent
+
+ except InvalidICalendarDataError, e:
+ log.err("%s: %s" % (self.path, e))
+
+ self.componentType = "?"
+ self.summary = "** Invalid data **"
+ self.mainComponent = None
+
+ self.component = component
+
@inlineCallbacks
def list(self):
(yield self.lookup())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120313/d9d40c32/attachment.html>
More information about the calendarserver-changes
mailing list