changeset 1157:64952ba7affe

pages: fixed children retrieval in onFileChange
author Goffi <goffi@goffi.org>
date Sat, 23 Feb 2019 21:04:31 +0100
parents 3048bd137aaf
children fb4b4da61132
files libervia/server/pages.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/pages.py	Sat Feb 23 21:03:21 2019 +0100
+++ b/libervia/server/pages.py	Sat Feb 23 21:04:31 2019 +0100
@@ -411,7 +411,10 @@
             new_page = False
             for idx, child_name in enumerate(path_elts):
                 try:
-                    page = page.children[child_name]
+                    try:
+                        page = page.original.children[child_name]
+                    except AttributeError:
+                        page = page.children[child_name]
                 except KeyError:
                     if idx != len(path_elts)-1:
                         # a page has been created in a subdir when one or more
@@ -429,7 +432,12 @@
                 __, resource = cls.createPage(host, path, site_root, path_elts,
                                               replace_on_conflict=True)
                 if not new_page:
-                    resource.children = page.original.children
+                    try:
+                        resource.children = page.original.children
+                    except AttributeError:
+                        # FIXME: this .original handling madness is due to EncodingResourceWrapper
+                        #        EncodingResourceWrapper should probably be removed
+                        resource.children = page.children
             except Exception as e:
                 log.warning(_(u"Can't create page: {reason}").format(reason=e))
             else: