mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
Use is_leaf and is_node instead of is_item and is_collection
This commit is contained in:
parent
5e8dec6683
commit
128a20714b
3 changed files with 26 additions and 15 deletions
|
@ -81,16 +81,16 @@ class Collection(ical.Collection):
|
|||
_, directories, files = next(os.walk(abs_path))
|
||||
for filename in directories + files:
|
||||
rel_filename = posixpath.join(path, filename)
|
||||
if cls.is_collection(rel_filename) or cls.is_item(rel_filename):
|
||||
if cls.is_node(rel_filename) or cls.is_leaf(rel_filename):
|
||||
yield cls(rel_filename)
|
||||
|
||||
@classmethod
|
||||
def is_collection(cls, path):
|
||||
def is_node(cls, path):
|
||||
abs_path = os.path.join(FOLDER, path.replace("/", os.sep))
|
||||
return os.path.isdir(abs_path)
|
||||
|
||||
@classmethod
|
||||
def is_item(cls, path):
|
||||
def is_leaf(cls, path):
|
||||
abs_path = os.path.join(FOLDER, path.replace("/", os.sep))
|
||||
return os.path.isfile(abs_path) and not abs_path.endswith(".props")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue