From 61ed08321869741a91bac268fef7d9613ddf3a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 13 Jul 2018 12:33:12 +0200 Subject: [PATCH] Don't change the global schema! --- pillar/api/nodes/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pillar/api/nodes/__init__.py b/pillar/api/nodes/__init__.py index f41925de..bf502b36 100644 --- a/pillar/api/nodes/__init__.py +++ b/pillar/api/nodes/__init__.py @@ -402,12 +402,16 @@ def textures_sort_files(nodes): def parse_markdown(node, original=None): + import copy + projects_collection = current_app.data.driver.db['projects'] project = projects_collection.find_one({'_id': node['project']}, {'node_types': 1}) # Query node type directly using the key node_type = next(nt for nt in project['node_types'] if nt['name'] == node['node_type']) - schema = current_app.config['DOMAIN']['nodes']['schema'] + + # Create a copy to not overwrite the actual schema. + schema = copy.deepcopy(current_app.config['DOMAIN']['nodes']['schema']) schema['properties'] = node_type['dyn_schema'] def find_markdown_fields(schema, node):