From 8f9d21cdd88d3aea4fc5fcd700ca4816ef238691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 22 Dec 2017 12:29:51 +0100 Subject: [PATCH] Fixed bug in parsing jstree A projection was missing, causing warnings that the node doesn't have a content type. --- pillar/web/utils/jstree.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pillar/web/utils/jstree.py b/pillar/web/utils/jstree.py index c9cc3d4b..978ea4f4 100644 --- a/pillar/web/utils/jstree.py +++ b/pillar/web/utils/jstree.py @@ -115,15 +115,17 @@ def jstree_build_from_node(node): # Get the parent node parent = None + parent_projection = {'projection': { + 'name': 1, + 'parent': 1, + 'project': 1, + 'node_type': 1, + 'properties.content_type': 1, + }} + if node.parent: try: - parent = Node.find(node.parent, { - 'projection': { - 'name': 1, - 'node_type': 1, - 'parent': 1, - 'properties.content_type': 1, - }}, api=api) + parent = Node.find(node.parent, parent_projection, api=api) # Define the child node of the tree (usually an asset) except ResourceNotFound: # If not found, we might be on the top level, in which case we skip the @@ -147,10 +149,7 @@ def jstree_build_from_node(node): # If we have a parent if parent.parent: try: - parent = Node.find(parent.parent, { - 'projection': { - 'name': 1, 'parent': 1, 'project': 1, 'node_type': 1}, - }, api=api) + parent = Node.find(parent.parent, parent_projection, api=api) except ResourceNotFound: parent = None else: