catch 2nd case for broken object
This commit is contained in:
parent
cd97aab72c
commit
a57fcad270
@ -635,7 +635,12 @@ class Collection(BaseCollection):
|
|||||||
last_modified = time.strftime(
|
last_modified = time.strftime(
|
||||||
"%a, %d %b %Y %H:%M:%S GMT",
|
"%a, %d %b %Y %H:%M:%S GMT",
|
||||||
time.gmtime(os.path.getmtime(path)))
|
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):
|
def has(self, href):
|
||||||
return self.get(href) is not None
|
return self.get(href) is not None
|
||||||
@ -712,7 +717,7 @@ class Collection(BaseCollection):
|
|||||||
try:
|
try:
|
||||||
items.append(vobject.readOne(fd.read()))
|
items.append(vobject.readOne(fd.read()))
|
||||||
except:
|
except:
|
||||||
self.logger.error("Object broken (skip): %s", path)
|
self.logger.error("Object broken (skip 'list'): %s", path)
|
||||||
time_end = datetime.datetime.now()
|
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)
|
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":
|
if self.get_meta("tag") == "VCALENDAR":
|
||||||
|
@ -796,6 +796,8 @@ def report(path, xml_request, collection):
|
|||||||
items = collection.pre_filtered_list(filters)
|
items = collection.pre_filtered_list(filters)
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
|
if not item:
|
||||||
|
continue
|
||||||
if filters:
|
if filters:
|
||||||
match = (
|
match = (
|
||||||
_comp_match if collection.get_meta("tag") == "VCALENDAR"
|
_comp_match if collection.get_meta("tag") == "VCALENDAR"
|
||||||
|
Loading…
Reference in New Issue
Block a user