catch 2nd case for broken object

This commit is contained in:
Peter Bieringer 2016-09-17 13:56:27 +02:00
parent cd97aab72c
commit a57fcad270
2 changed files with 9 additions and 2 deletions

View File

@ -635,7 +635,12 @@ class Collection(BaseCollection):
last_modified = time.strftime(
"%a, %d %b %Y %H:%M:%S GMT",
time.gmtime(os.path.getmtime(path)))
return Item(self, vobject.readOne(text), href, last_modified)
try:
item = Item(self, vobject.readOne(text), href, last_modified)
except:
self.logger.error("Object broken (skip 'get'): %s", path)
return None;
return item;
def has(self, href):
return self.get(href) is not None
@ -712,7 +717,7 @@ class Collection(BaseCollection):
try:
items.append(vobject.readOne(fd.read()))
except:
self.logger.error("Object broken (skip): %s", path)
self.logger.error("Object broken (skip 'list'): %s", path)
time_end = datetime.datetime.now()
self.logger.info("Collection read %d items in %s sec from %s", len(items),(time_end - time_begin).total_seconds(), self._filesystem_path)
if self.get_meta("tag") == "VCALENDAR":

View File

@ -796,6 +796,8 @@ def report(path, xml_request, collection):
items = collection.pre_filtered_list(filters)
for item in items:
if not item:
continue
if filters:
match = (
_comp_match if collection.get_meta("tag") == "VCALENDAR"