Duplicate code: Use list and get methods
This commit is contained in:
parent
5dbf9df876
commit
e7d8b4816c
@ -698,17 +698,9 @@ class Collection(BaseCollection):
|
|||||||
return time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(last))
|
return time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(last))
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
if not os.path.exists(self._filesystem_path):
|
|
||||||
return None
|
|
||||||
items = []
|
items = []
|
||||||
for href in os.listdir(self._filesystem_path):
|
for href in self.list():
|
||||||
if not is_safe_filesystem_path_component(href):
|
items.append(self.get(href).item)
|
||||||
self.logger.debug("Skipping component: %s", href)
|
|
||||||
continue
|
|
||||||
path = os.path.join(self._filesystem_path, href)
|
|
||||||
if os.path.isfile(path):
|
|
||||||
with open(path, encoding=self.encoding, newline="") as fd:
|
|
||||||
items.append(vobject.readOne(fd.read()))
|
|
||||||
if self.get_meta("tag") == "VCALENDAR":
|
if self.get_meta("tag") == "VCALENDAR":
|
||||||
collection = vobject.iCalendar()
|
collection = vobject.iCalendar()
|
||||||
for item in items:
|
for item in items:
|
||||||
|
Loading…
Reference in New Issue
Block a user