From fe148e1e6b6109d2380830b66ccd3837f2097f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 19 Jul 2016 12:33:42 +0200 Subject: [PATCH] Simplified settings by introducing _node_embedded_schema. This follows the same style as the already-existing _file_embedded_schema. --- pillar/settings.py | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/pillar/settings.py b/pillar/settings.py index 5c553092..f0899739 100644 --- a/pillar/settings.py +++ b/pillar/settings.py @@ -21,6 +21,15 @@ _file_embedded_schema = { } } +_node_embedded_schema = { + 'type': 'objectid', + 'data_relation': { + 'resource': 'nodes', + 'field': '_id', + 'embeddable': True + } +} + _required_user_embedded_schema = { 'type': 'objectid', 'required': True, @@ -147,15 +156,9 @@ organizations_schema = { 'type': 'string', 'maxlength': 256, }, - 'picture': { - 'type': 'objectid', - 'nullable': True, - 'data_relation': { - 'resource': 'files', - 'field': '_id', - 'embeddable': True - }, - }, + 'picture': dict( + nullable=True, + **_file_embedded_schema), 'users': { 'type': 'list', 'default': [], @@ -271,14 +274,7 @@ nodes_schema = { 'description': { 'type': 'string', }, - 'picture': { - 'type': 'objectid', - 'data_relation': { - 'resource': 'files', - 'field': '_id', - 'embeddable': True - }, - }, + 'picture': _file_embedded_schema, 'order': { 'type': 'integer', 'minlength': 0, @@ -286,14 +282,7 @@ nodes_schema = { 'revision': { 'type': 'integer', }, - 'parent': { - 'type': 'objectid', - 'data_relation': { - 'resource': 'nodes', - 'field': '_id', - 'embeddable': True - }, - }, + 'parent': _node_embedded_schema, 'project': { 'type': 'objectid', 'data_relation': {