changeset 590:3cca1f6bd610

debug: Fix how the linker shows children/siblings/etc. in the debug window.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 17 Jan 2016 23:08:40 -0800
parents 9650638e504d
children eedd63b7cf42
files piecrust/data/linker.py
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/data/linker.py	Sun Jan 17 21:45:42 2016 -0800
+++ b/piecrust/data/linker.py	Sun Jan 17 23:08:40 2016 -0800
@@ -15,7 +15,13 @@
     """
     debug_render = ['parent', 'ancestors', 'siblings', 'children', 'root',
                     'forpath']
-    debug_render_invoke = ['parent', 'siblings', 'children']
+    debug_render_invoke = ['parent', 'ancestors', 'siblings', 'children',
+                           'root']
+    debug_render_redirect = {
+            'ancestors': '_debugRenderAncestors',
+            'siblings': '_debugRenderSiblings',
+            'children': '_debugRenderChildren',
+            'root': '_debugRenderRoot'}
 
     def __init__(self, source, page_path):
         self._source = source
@@ -84,6 +90,21 @@
         self._linker = Linker(self._source, dir_path,
                               root_page_path=self._root_page_path)
 
+    def _debugRenderAncestors(self):
+        return [i.name for i in self.ancestors]
+
+    def _debugRenderSiblings(self):
+        return [i.name for i in self.siblings]
+
+    def _debugRenderChildren(self):
+        return [i.name for i in self.children]
+
+    def _debugRenderRoot(self):
+        r = self.root
+        if r is not None:
+            return r.name
+        return None
+
 
 class LinkedPageData(PaginationData):
     """ Class whose instances get returned when iterating on a `Linker`