From 3e8494e3bf2705a416550c9fa88f4ab084c95bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 2 May 2016 17:06:59 +0200 Subject: [PATCH] Use soft-delete for nodes --- pillar/manage_extra/node_types/comment.py | 1 - pillar/manage_extra/node_types/group.py | 1 - pillar/manage_extra/node_types/group_texture.py | 1 - pillar/manage_extra/node_types/page.py | 1 - pillar/manage_extra/node_types/post.py | 1 - pillar/manage_extra/node_types/project.py | 1 - pillar/manage_extra/node_types/texture.py | 1 - pillar/settings.py | 2 +- tests/common_test_data.py | 15 ++++++--------- tests/test_project_management.py | 4 ++-- 10 files changed, 9 insertions(+), 19 deletions(-) diff --git a/pillar/manage_extra/node_types/comment.py b/pillar/manage_extra/node_types/comment.py index 0e2ddd8f..808f79fb 100644 --- a/pillar/manage_extra/node_types/comment.py +++ b/pillar/manage_extra/node_types/comment.py @@ -11,7 +11,6 @@ node_type_comment = { 'type': 'string', 'allowed': [ 'published', - 'deleted', 'flagged', 'edited' ], diff --git a/pillar/manage_extra/node_types/group.py b/pillar/manage_extra/node_types/group.py index b7fea34c..40768c0a 100644 --- a/pillar/manage_extra/node_types/group.py +++ b/pillar/manage_extra/node_types/group.py @@ -15,7 +15,6 @@ node_type_group = { 'allowed': [ 'published', 'pending', - 'deleted' ], }, 'notes': { diff --git a/pillar/manage_extra/node_types/group_texture.py b/pillar/manage_extra/node_types/group_texture.py index eb4affff..c9d832cd 100644 --- a/pillar/manage_extra/node_types/group_texture.py +++ b/pillar/manage_extra/node_types/group_texture.py @@ -15,7 +15,6 @@ node_type_group_texture = { 'allowed': [ 'published', 'pending', - 'deleted' ], } }, diff --git a/pillar/manage_extra/node_types/page.py b/pillar/manage_extra/node_types/page.py index 30b498ed..73a74744 100644 --- a/pillar/manage_extra/node_types/page.py +++ b/pillar/manage_extra/node_types/page.py @@ -15,7 +15,6 @@ node_type_page = { 'type': 'string', 'allowed': [ 'published', - 'deleted', 'pending' ], 'default': 'pending' diff --git a/pillar/manage_extra/node_types/post.py b/pillar/manage_extra/node_types/post.py index c6e9e9b6..f24aade8 100644 --- a/pillar/manage_extra/node_types/post.py +++ b/pillar/manage_extra/node_types/post.py @@ -15,7 +15,6 @@ node_type_post = { 'type': 'string', 'allowed': [ 'published', - 'deleted', 'pending' ], 'default': 'pending' diff --git a/pillar/manage_extra/node_types/project.py b/pillar/manage_extra/node_types/project.py index 668bc553..df3be7fe 100644 --- a/pillar/manage_extra/node_types/project.py +++ b/pillar/manage_extra/node_types/project.py @@ -58,7 +58,6 @@ node_type_project = { 'allowed': [ 'published', 'pending', - 'deleted' ], }, # Logo diff --git a/pillar/manage_extra/node_types/texture.py b/pillar/manage_extra/node_types/texture.py index 07cd95a2..a90fe0dd 100644 --- a/pillar/manage_extra/node_types/texture.py +++ b/pillar/manage_extra/node_types/texture.py @@ -13,7 +13,6 @@ node_type_texture = { 'published', 'pending', 'processing', - 'deleted' ], }, # Used for sorting within the context of a group diff --git a/pillar/settings.py b/pillar/settings.py index 3133b4c6..cffcf4cc 100644 --- a/pillar/settings.py +++ b/pillar/settings.py @@ -579,7 +579,6 @@ projects_schema = { 'allowed': [ 'published', 'pending', - 'deleted' ], }, # Latest nodes being edited @@ -701,6 +700,7 @@ nodes = { 'schema': nodes_schema, 'public_methods': ['GET'], 'public_item_methods': ['GET'], + 'soft_delete': True, } users = { diff --git a/tests/common_test_data.py b/tests/common_test_data.py index bd41944c..f9717496 100644 --- a/tests/common_test_data.py +++ b/tests/common_test_data.py @@ -40,7 +40,7 @@ EXAMPLE_PROJECT = { u'name': u'Textures', u'node_types': [{u'description': u'Group for texture node type', u'dyn_schema': {u'order': {u'type': u'integer'}, - u'status': {u'allowed': [u'published', u'pending', u'deleted'], + u'status': {u'allowed': [u'published', u'pending'], u'type': u'string'}, u'url': {u'type': u'string'}}, u'form_schema': {u'order': {}, u'status': {}, u'url': {}}, @@ -59,7 +59,7 @@ EXAMPLE_PROJECT = { {u'description': u'Generic group node type edited', u'dyn_schema': {u'notes': {u'maxlength': 256, u'type': u'string'}, u'order': {u'type': u'integer'}, - u'status': {u'allowed': [u'published', u'pending', u'deleted'], + u'status': {u'allowed': [u'published', u'pending'], u'type': u'string'}, u'url': {u'type': u'string'}}, u'form_schema': {u'notes': {}, u'order': {}, u'status': {}, u'url': {}}, @@ -101,8 +101,7 @@ EXAMPLE_PROJECT = { u'order': {u'type': u'integer'}, u'status': {u'allowed': [u'published', u'pending', - u'processing', - u'deleted'], + u'processing'], u'type': u'string'}, u'tags': {u'schema': {u'type': u'string'}, u'type': u'list'}}, u'form_schema': {u'attachments': {u'visible': False}, @@ -148,8 +147,7 @@ EXAMPLE_PROJECT = { u'weight': {u'type': u'integer'}}, u'type': u'dict'}, u'type': u'list'}, - u'status': {u'allowed': [u'published', u'deleted', u'flagged', - u'edited'], + u'status': {u'allowed': [u'published', u'flagged', u'edited'], u'type': u'string'}}, u'form_schema': {u'confidence': {}, u'content': {}, @@ -203,7 +201,7 @@ EXAMPLE_PROJECT = { u'minlength': 5, u'required': True, u'type': u'string'}, - u'status': {u'allowed': [u'published', u'deleted', u'pending'], + u'status': {u'allowed': [u'published', u'pending'], u'default': u'pending', u'type': u'string'}, u'url': {u'type': u'string'}}, @@ -243,8 +241,7 @@ EXAMPLE_PROJECT = { u'resolution': {u'type': u'string'}, u'stat_ensure_file_existsus': {u'allowed': [u'published', u'pending', - u'processing', - u'deleted'], + u'processing'], u'type': u'string'}, u'tags': {u'schema': {u'type': u'string'}, u'type': u'list'}}, u'form_schema': {u'aspect_ratio': {}, diff --git a/tests/test_project_management.py b/tests/test_project_management.py index 8c55c591..e3f0a98e 100644 --- a/tests/test_project_management.py +++ b/tests/test_project_management.py @@ -113,7 +113,7 @@ class ProjectEditTest(AbstractProjectTest): put_project['name'] = u'โครงการปั่นเมฆ' put_project['summary'] = u'Это переведена на Google' put_project['is_private'] = False - put_project['status'] = 'deleted' + put_project['status'] = 'pending' put_project['category'] = 'software' put_project['user'] = other_user_id @@ -161,7 +161,7 @@ class ProjectEditTest(AbstractProjectTest): put_project['name'] = u'โครงการปั่นเมฆ' put_project['summary'] = u'Это переведена на Google' put_project['is_private'] = False - put_project['status'] = 'deleted' + put_project['status'] = 'pending' put_project['category'] = 'software' put_project['user'] = other_user_id