mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 21:54:53 -04:00
commit
dbf6f28d64
4 changed files with 10 additions and 7 deletions
|
@ -40,9 +40,12 @@ def create_resource_tree(desired_tree, root_resource):
|
|||
# extra resources to existing nodes. See self._resource_id for the key.
|
||||
resource_mappings = {}
|
||||
for full_path, res in desired_tree.items():
|
||||
# twisted requires all resources to be bytes
|
||||
full_path = full_path.encode("utf-8")
|
||||
|
||||
logger.info("Attaching %s to path %s", res, full_path)
|
||||
last_resource = root_resource
|
||||
for path_seg in full_path.split('/')[1:-1]:
|
||||
for path_seg in full_path.split(b'/')[1:-1]:
|
||||
if path_seg not in last_resource.listNames():
|
||||
# resource doesn't exist, so make a "dummy resource"
|
||||
child_resource = NoResource()
|
||||
|
@ -57,7 +60,7 @@ def create_resource_tree(desired_tree, root_resource):
|
|||
|
||||
# ===========================
|
||||
# now attach the actual desired resource
|
||||
last_path_seg = full_path.split('/')[-1]
|
||||
last_path_seg = full_path.split(b'/')[-1]
|
||||
|
||||
# if there is already a resource here, thieve its children and
|
||||
# replace it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue