Support generic component names

This commit is contained in:
Unrud 2017-08-30 18:03:41 +02:00
parent cfb9b1fc0a
commit f3c368e547

View File

@ -186,7 +186,8 @@ def _comp_match(item, filter_, level=0):
return name != tag return name != tag
if name != tag: if name != tag:
return False return False
if name in ("VALARM", "VFREEBUSY"): if (level == 0 and name != "VCALENDAR" or
level == 1 and name not in ("VTODO", "VEVENT", "VJOURNAL")):
item.collection.logger.warning("Filtering %s is not supported" % name) item.collection.logger.warning("Filtering %s is not supported" % name)
return True return True
# Point #3 and #4 of rfc4791-9.7.1 # Point #3 and #4 of rfc4791-9.7.1
@ -643,8 +644,7 @@ def find_tag(vobject_item):
"""Find tag from ``vobject_item``.""" """Find tag from ``vobject_item``."""
if vobject_item.name == "VCALENDAR": if vobject_item.name == "VCALENDAR":
for component in vobject_item.components(): for component in vobject_item.components():
if component.name in ("VTODO", "VEVENT", "VJOURNAL", if component.name != "VTIMEZONE":
"VFREEBUSY", "VALARM"):
return component.name return component.name
return None return None