Fix the collection detection
This commit is contained in:
parent
97f8738465
commit
224d0d47e8
@ -23,6 +23,7 @@ Filesystem storage backend.
|
|||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
|
import posixpath
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
@ -76,10 +77,10 @@ class Collection(ical.Collection):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def children(cls, path):
|
def children(cls, path):
|
||||||
rel_path = path.replace("/", os.sep)
|
abs_path = os.path.join(FOLDER, path.replace("/", os.sep))
|
||||||
abs_path = os.path.join(FOLDER, rel_path)
|
_, directories, files = next(os.walk(abs_path))
|
||||||
for filename in next(os.walk(abs_path))[2]:
|
for filename in directories + files:
|
||||||
rel_filename = os.path.join(rel_path, filename)
|
rel_filename = posixpath.join(path, filename)
|
||||||
if cls.is_collection(rel_filename) or cls.is_item(rel_filename):
|
if cls.is_collection(rel_filename) or cls.is_item(rel_filename):
|
||||||
yield cls(rel_filename)
|
yield cls(rel_filename)
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ def _propfind_response(path, item, props, user):
|
|||||||
if item.is_principal:
|
if item.is_principal:
|
||||||
tag = ET.Element(_tag("D", "principal"))
|
tag = ET.Element(_tag("D", "principal"))
|
||||||
element.append(tag)
|
element.append(tag)
|
||||||
else:
|
if item.is_item(item.path):
|
||||||
tag = ET.Element(_tag("C", item.resource_type))
|
tag = ET.Element(_tag("C", item.resource_type))
|
||||||
element.append(tag)
|
element.append(tag)
|
||||||
tag = ET.Element(_tag("D", "collection"))
|
tag = ET.Element(_tag("D", "collection"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user