Style
This commit is contained in:
@@ -103,8 +103,7 @@ class Collection(ical.Collection):
|
||||
# make sure that the local filename can be translated
|
||||
# into an internal path
|
||||
if not pathutils.is_safe_path_component(filename):
|
||||
log.LOGGER.debug("Skipping unsupported filename: %s",
|
||||
filename)
|
||||
log.LOGGER.debug("Skipping unsupported filename: %s", filename)
|
||||
continue
|
||||
rel_filename = posixpath.join(path, filename)
|
||||
if cls.is_node(rel_filename) or cls.is_leaf(rel_filename):
|
||||
@@ -118,13 +117,14 @@ class Collection(ical.Collection):
|
||||
@classmethod
|
||||
def is_leaf(cls, path):
|
||||
filesystem_path = pathutils.path_to_filesystem(path, FOLDER)
|
||||
return (os.path.isfile(filesystem_path) and not
|
||||
filesystem_path.endswith(".props"))
|
||||
return (
|
||||
os.path.isfile(filesystem_path) and not
|
||||
filesystem_path.endswith(".props"))
|
||||
|
||||
@property
|
||||
def last_modified(self):
|
||||
modification_time = \
|
||||
time.gmtime(os.path.getmtime(self._filesystem_path))
|
||||
modification_time = time.gmtime(
|
||||
os.path.getmtime(self._filesystem_path))
|
||||
return time.strftime("%a, %d %b %Y %H:%M:%S +0000", modification_time)
|
||||
|
||||
@property
|
||||
|
@@ -84,8 +84,9 @@ class Collection(filesystem.Collection):
|
||||
try:
|
||||
filenames = os.listdir(self._filesystem_path)
|
||||
except (OSError, IOError) as e:
|
||||
log.LOGGER.info('Error while reading collection %r: %r'
|
||||
% (self._filesystem_path, e))
|
||||
log.LOGGER.info(
|
||||
'Error while reading collection %r: %r' % (
|
||||
self._filesystem_path, e))
|
||||
return ""
|
||||
|
||||
for filename in filenames:
|
||||
@@ -94,25 +95,24 @@ class Collection(filesystem.Collection):
|
||||
with filesystem.open(path) as fd:
|
||||
items.update(self._parse(fd.read(), components))
|
||||
except (OSError, IOError) as e:
|
||||
log.LOGGER.warning('Error while reading item %r: %r'
|
||||
% (path, e))
|
||||
log.LOGGER.warning(
|
||||
'Error while reading item %r: %r' % (path, e))
|
||||
|
||||
return ical.serialize(
|
||||
self.tag, self.headers, sorted(items, key=lambda x: x.name))
|
||||
|
||||
@classmethod
|
||||
def is_node(cls, path):
|
||||
filesystem_path = pathutils.path_to_filesystem(path,
|
||||
filesystem.FOLDER)
|
||||
return (os.path.isdir(filesystem_path) and
|
||||
not os.path.exists(filesystem_path + ".props"))
|
||||
filesystem_path = pathutils.path_to_filesystem(path, filesystem.FOLDER)
|
||||
return (
|
||||
os.path.isdir(filesystem_path) and
|
||||
not os.path.exists(filesystem_path + ".props"))
|
||||
|
||||
@classmethod
|
||||
def is_leaf(cls, path):
|
||||
filesystem_path = pathutils.path_to_filesystem(path,
|
||||
filesystem.FOLDER)
|
||||
return (os.path.isdir(filesystem_path) and
|
||||
os.path.exists(path + ".props"))
|
||||
filesystem_path = pathutils.path_to_filesystem(path, filesystem.FOLDER)
|
||||
return (
|
||||
os.path.isdir(filesystem_path) and os.path.exists(path + ".props"))
|
||||
|
||||
@property
|
||||
def last_modified(self):
|
||||
|
Reference in New Issue
Block a user