Bläddra i källkod

rename vars: change case

Guénaël Muller 6 år sedan
förälder
incheckning
bde1f85f9b

+ 11 - 11
backend/tracim_backend/app_models/contents.py Visa fil

@@ -2,7 +2,7 @@
2 2
 import typing
3 3
 from enum import Enum
4 4
 
5
-from tracim_backend.extensions import APP_LIST
5
+from tracim_backend.extensions import app_list
6 6
 from tracim_backend.exceptions import ContentTypeNotExist
7 7
 from tracim_backend.exceptions import ContentStatusNotExist
8 8
 
@@ -132,11 +132,11 @@ class ContentType(object):
132 132
         self.allow_sub_content = allow_sub_content
133 133
 
134 134
 
135
-thread_type = 'thread'
136
-file_type = 'file'
137
-markdownpluspage_type = 'markdownpage'
138
-html_documents_type = 'html-document'
139
-folder_type = 'folder'
135
+THREAD_TYPE = 'thread'
136
+FILE_TYPE = 'file'
137
+MARKDOWNPLUSPAGE_TYPE = 'markdownpage'
138
+HTML_DOCUMENTS_TYPE = 'html-document'
139
+FOLDER_TYPE = 'folder'
140 140
 
141 141
 # TODO - G.M - 31-05-2018 - Set Better Event params
142 142
 event_type = ContentType(
@@ -169,19 +169,19 @@ class ContentTypeList(object):
169 169
 
170 170
     @property
171 171
     def Folder(self):
172
-        return self.get_one_by_slug(folder_type)
172
+        return self.get_one_by_slug(FOLDER_TYPE)
173 173
 
174 174
     @property
175 175
     def File(self):
176
-        return self.get_one_by_slug(file_type)
176
+        return self.get_one_by_slug(FILE_TYPE)
177 177
 
178 178
     @property
179 179
     def Page(self):
180
-        return self.get_one_by_slug(html_documents_type)
180
+        return self.get_one_by_slug(HTML_DOCUMENTS_TYPE)
181 181
 
182 182
     @property
183 183
     def Thread(self):
184
-        return self.get_one_by_slug(thread_type)
184
+        return self.get_one_by_slug(THREAD_TYPE)
185 185
 
186 186
     def __init__(self, app_list: typing.List['Application']):
187 187
         self.app_list = app_list
@@ -255,4 +255,4 @@ class ContentTypeList(object):
255 255
         return properties_dict
256 256
 
257 257
 
258
-CONTENT_TYPES = ContentTypeList(APP_LIST)
258
+CONTENT_TYPES = ContentTypeList(app_list)

+ 3 - 3
backend/tracim_backend/app_models/validator.py Visa fil

@@ -2,10 +2,10 @@ from marshmallow.validate import OneOf
2 2
 from tracim_backend.app_models.contents import CONTENT_TYPES
3 3
 
4 4
 # TODO - G.M - 2018-08-08 - [GlobalVar] Refactor Global var
5
-# of tracim_backend, Be careful ALL_CONTENT_TYPES_VALIDATOR is a global_var !
5
+# of tracim_backend, Be careful all_content_types_validator is a global_var !
6 6
 
7
-ALL_CONTENT_TYPES_VALIDATOR = OneOf(choices=[])
7
+all_content_types_validator = OneOf(choices=[])
8 8
 
9 9
 
10 10
 def update_validators():
11
-    ALL_CONTENT_TYPES_VALIDATOR.choices = CONTENT_TYPES.endpoint_allowed_types_slug()  # nopep8
11
+    all_content_types_validator.choices = CONTENT_TYPES.endpoint_allowed_types_slug()  # nopep8

+ 5 - 5
backend/tracim_backend/config.py Visa fil

@@ -5,7 +5,7 @@ from urllib.parse import urlparse
5 5
 import os
6 6
 from paste.deploy.converters import asbool
7 7
 from tracim_backend.app_models.validator import update_validators
8
-from tracim_backend.extensions import APP_LIST
8
+from tracim_backend.extensions import app_list
9 9
 from tracim_backend.lib.utils.logger import logger
10 10
 from depot.manager import DepotManager
11 11
 from tracim_backend.app_models.applications import Application
@@ -606,9 +606,9 @@ class CFG(object):
606 606
         )
607 607
 
608 608
         # TODO - G.M - 2018-08-08 - [GlobalVar] Refactor Global var
609
-        # of tracim_backend, Be careful APP_LIST is a global_var
610
-        APP_LIST.clear()
611
-        APP_LIST.extend([
609
+        # of tracim_backend, Be careful app_list is a global_var
610
+        app_list.clear()
611
+        app_list.extend([
612 612
             html_documents,
613 613
             markdownpluspage,
614 614
             _file,
@@ -617,7 +617,7 @@ class CFG(object):
617 617
             calendar,
618 618
         ])
619 619
         # TODO - G.M - 2018-08-08 - We need to update validators each time
620
-        # APP_LIST is updated.
620
+        # app_list is updated.
621 621
         update_validators()
622 622
 
623 623
     class CST(object):

+ 6 - 6
backend/tracim_backend/extensions.py Visa fil

@@ -4,11 +4,11 @@ hapic = Hapic()
4 4
 
5 5
 # TODO - G.M - 2018-08-08 - [GlobalVar] Refactor Global var of tracim_backend
6 6
 
7
-# INFO - G.M - 2018-08-08 - APP_LIST
8
-# APP_LIST is one of the few "global_val" in tracim_backend, with hapic
9
-# and ALL_CONTENT_TYPES_VALIDATOR.
7
+# INFO - G.M - 2018-08-08 - app_list
8
+# app_list is one of the few "global_val" in tracim_backend, with hapic
9
+# and all_content_types_validator.
10 10
 # The goal of this is to be able to get current list of loaded app.
11 11
 # List is empty until config load apps.
12
-# If you need to update APP_LIST, think about updating Content validator like
13
-# ALL_CONTENT_TYPES_VALIDATOR , see  update_validators() method.
14
-APP_LIST = []
12
+# If you need to update app_list, think about updating Content validator like
13
+# all_content_types_validator , see  update_validators() method.
14
+app_list = []

+ 2 - 2
backend/tracim_backend/models/context_models.py Visa fil

@@ -7,7 +7,7 @@ from slugify import slugify
7 7
 from sqlalchemy.orm import Session
8 8
 from tracim_backend.config import CFG
9 9
 from tracim_backend.config import PreviewDim
10
-from tracim_backend.extensions import APP_LIST
10
+from tracim_backend.extensions import app_list
11 11
 from tracim_backend.lib.core.application import ApplicationApi
12 12
 from tracim_backend.lib.utils.utils import get_root_frontend_url
13 13
 from tracim_backend.lib.utils.utils import password_generator
@@ -495,7 +495,7 @@ class WorkspaceInContext(object):
495 495
         # list should be able to change (depending on activated/disabled
496 496
         # apps)
497 497
         app_api = ApplicationApi(
498
-            APP_LIST
498
+            app_list
499 499
         )
500 500
         return app_api.get_default_workspace_menu_entry(self.workspace)
501 501
 

+ 2 - 2
backend/tracim_backend/tests/functional/test_system.py Visa fil

@@ -1,6 +1,6 @@
1 1
 # coding=utf-8
2 2
 import transaction
3
-from tracim_backend.extensions import APP_LIST
3
+from tracim_backend.extensions import app_list
4 4
 from tracim_backend.lib.core.application import ApplicationApi
5 5
 from tracim_backend.models import get_tm_session
6 6
 from tracim_backend.app_models.contents import CONTENT_TYPES
@@ -31,7 +31,7 @@ class TestApplicationEndpoint(FunctionalTest):
31 31
         res = res.json_body
32 32
         dbsession = get_tm_session(self.session_factory, transaction.manager)
33 33
         app_api = ApplicationApi(
34
-            app_list=APP_LIST,
34
+            app_list=app_list,
35 35
         )
36 36
         applications = app_api.get_all()
37 37
         assert len(res) == len(applications)

+ 2 - 2
backend/tracim_backend/tests/functional/test_user.py Visa fil

@@ -8,7 +8,7 @@ import requests
8 8
 import transaction
9 9
 
10 10
 from tracim_backend import models
11
-from tracim_backend.extensions import APP_LIST
11
+from tracim_backend.extensions import app_list
12 12
 from tracim_backend.lib.core.application import ApplicationApi
13 13
 from tracim_backend.lib.core.content import ContentApi
14 14
 from tracim_backend.lib.core.user import UserApi
@@ -2384,7 +2384,7 @@ class TestUserWorkspaceEndpoint(FunctionalTest):
2384 2384
         )
2385 2385
         workspace = workspace_api.get_one(1)
2386 2386
         app_api = ApplicationApi(
2387
-            APP_LIST
2387
+            app_list
2388 2388
         )
2389 2389
 
2390 2390
         default_sidebar_entry = app_api.get_default_workspace_menu_entry(workspace=workspace)  # nope8

+ 3 - 3
backend/tracim_backend/tests/functional/test_workspaces.py Visa fil

@@ -7,7 +7,7 @@ import transaction
7 7
 from depot.io.utils import FileIntent
8 8
 
9 9
 from tracim_backend import models
10
-from tracim_backend.extensions import APP_LIST
10
+from tracim_backend.extensions import app_list
11 11
 from tracim_backend.lib.core.application import ApplicationApi
12 12
 from tracim_backend.lib.core.content import ContentApi
13 13
 from tracim_backend.lib.core.group import GroupApi
@@ -46,7 +46,7 @@ class TestWorkspaceEndpoint(FunctionalTest):
46 46
         )
47 47
         workspace = workspace_api.get_one(1)
48 48
         app_api = ApplicationApi(
49
-            APP_LIST
49
+            app_list
50 50
         )
51 51
         default_sidebar_entry = app_api.get_default_workspace_menu_entry(workspace=workspace)  # nope8
52 52
 
@@ -89,7 +89,7 @@ class TestWorkspaceEndpoint(FunctionalTest):
89 89
         )
90 90
         workspace = workspace_api.get_one(1)
91 91
         app_api = ApplicationApi(
92
-            APP_LIST
92
+            app_list
93 93
         )
94 94
         default_sidebar_entry = app_api.get_default_workspace_menu_entry(workspace=workspace)  # nope8
95 95
 

+ 15 - 15
backend/tracim_backend/views/contents_api/file_controller.py Visa fil

@@ -33,7 +33,7 @@ from tracim_backend.models.data import UserRoleInWorkspace
33 33
 from tracim_backend.models.context_models import ContentInContext
34 34
 from tracim_backend.models.context_models import RevisionInContext
35 35
 from tracim_backend.app_models.contents import CONTENT_TYPES
36
-from tracim_backend.app_models.contents import file_type
36
+from tracim_backend.app_models.contents import FILE_TYPE
37 37
 from tracim_backend.models.revision_protection import new_revision
38 38
 from tracim_backend.exceptions import EmptyLabelNotAllowed
39 39
 from tracim_backend.exceptions import PageOfPreviewNotFound
@@ -50,7 +50,7 @@ class FileController(Controller):
50 50
     # File data
51 51
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
52 52
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
53
-    @require_content_types([file_type])
53
+    @require_content_types([FILE_TYPE])
54 54
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
55 55
     # TODO - G.M - 2018-07-24 - Use hapic for input file
56 56
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8
@@ -88,7 +88,7 @@ class FileController(Controller):
88 88
 
89 89
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
90 90
     @require_workspace_role(UserRoleInWorkspace.READER)
91
-    @require_content_types([file_type])
91
+    @require_content_types([FILE_TYPE])
92 92
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
93 93
     @hapic.output_file([])
94 94
     def download_file(self, context, request: TracimRequest, hapic_data=None):
@@ -115,7 +115,7 @@ class FileController(Controller):
115 115
 
116 116
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
117 117
     @require_workspace_role(UserRoleInWorkspace.READER)
118
-    @require_content_types([file_type])
118
+    @require_content_types([FILE_TYPE])
119 119
     @hapic.input_path(WorkspaceAndContentRevisionIdPathSchema())
120 120
     @hapic.output_file([])
121 121
     def download_revisions_file(self, context, request: TracimRequest, hapic_data=None):  # nopep8
@@ -148,7 +148,7 @@ class FileController(Controller):
148 148
     # pdf
149 149
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
150 150
     @require_workspace_role(UserRoleInWorkspace.READER)
151
-    @require_content_types([file_type])
151
+    @require_content_types([FILE_TYPE])
152 152
     @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
153 153
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
154 154
     @hapic.input_query(PageQuerySchema())
@@ -179,7 +179,7 @@ class FileController(Controller):
179 179
 
180 180
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
181 181
     @require_workspace_role(UserRoleInWorkspace.READER)
182
-    @require_content_types([file_type])
182
+    @require_content_types([FILE_TYPE])
183 183
     @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
184 184
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
185 185
     @hapic.output_file([])
@@ -204,7 +204,7 @@ class FileController(Controller):
204 204
 
205 205
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
206 206
     @require_workspace_role(UserRoleInWorkspace.READER)
207
-    @require_content_types([file_type])
207
+    @require_content_types([FILE_TYPE])
208 208
     @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
209 209
     @hapic.input_path(WorkspaceAndContentRevisionIdPathSchema())
210 210
     @hapic.input_query(PageQuerySchema())
@@ -239,7 +239,7 @@ class FileController(Controller):
239 239
     # jpg
240 240
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
241 241
     @require_workspace_role(UserRoleInWorkspace.READER)
242
-    @require_content_types([file_type])
242
+    @require_content_types([FILE_TYPE])
243 243
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
244 244
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
245 245
     @hapic.input_query(PageQuerySchema())
@@ -272,7 +272,7 @@ class FileController(Controller):
272 272
 
273 273
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
274 274
     @require_workspace_role(UserRoleInWorkspace.READER)
275
-    @require_content_types([file_type])
275
+    @require_content_types([FILE_TYPE])
276 276
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
277 277
     @hapic.handle_exception(PreviewDimNotAllowed, HTTPStatus.BAD_REQUEST)
278 278
     @hapic.input_query(PageQuerySchema())
@@ -305,7 +305,7 @@ class FileController(Controller):
305 305
 
306 306
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
307 307
     @require_workspace_role(UserRoleInWorkspace.READER)
308
-    @require_content_types([file_type])
308
+    @require_content_types([FILE_TYPE])
309 309
     @hapic.handle_exception(PageOfPreviewNotFound, HTTPStatus.BAD_REQUEST)
310 310
     @hapic.handle_exception(PreviewDimNotAllowed, HTTPStatus.BAD_REQUEST)
311 311
     @hapic.input_path(RevisionPreviewSizedPathSchema())
@@ -342,7 +342,7 @@ class FileController(Controller):
342 342
 
343 343
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
344 344
     @require_workspace_role(UserRoleInWorkspace.READER)
345
-    @require_content_types([file_type])
345
+    @require_content_types([FILE_TYPE])
346 346
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
347 347
     @hapic.output_body(AllowedJpgPreviewDimSchema())
348 348
     def allowed_dim_preview_jpg(self, context, request: TracimRequest, hapic_data=None):  # nopep8
@@ -363,7 +363,7 @@ class FileController(Controller):
363 363
     # File infos
364 364
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
365 365
     @require_workspace_role(UserRoleInWorkspace.READER)
366
-    @require_content_types([file_type])
366
+    @require_content_types([FILE_TYPE])
367 367
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
368 368
     @hapic.output_body(FileContentSchema())
369 369
     def get_file_infos(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext:  # nopep8
@@ -387,7 +387,7 @@ class FileController(Controller):
387 387
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
388 388
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
389 389
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
390
-    @require_content_types([file_type])
390
+    @require_content_types([FILE_TYPE])
391 391
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
392 392
     @hapic.input_body(FileContentModifySchema())
393 393
     @hapic.output_body(FileContentSchema())
@@ -423,7 +423,7 @@ class FileController(Controller):
423 423
 
424 424
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
425 425
     @require_workspace_role(UserRoleInWorkspace.READER)
426
-    @require_content_types([file_type])
426
+    @require_content_types([FILE_TYPE])
427 427
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
428 428
     @hapic.output_body(FileRevisionSchema(many=True))
429 429
     def get_file_revisions(
@@ -456,7 +456,7 @@ class FileController(Controller):
456 456
     @hapic.with_api_doc(tags=[SWAGGER_TAG__FILE_ENDPOINTS])
457 457
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
458 458
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
459
-    @require_content_types([file_type])
459
+    @require_content_types([FILE_TYPE])
460 460
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
461 461
     @hapic.input_body(SetContentStatusSchema())
462 462
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8

+ 5 - 5
backend/tracim_backend/views/contents_api/folder_controller.py Visa fil

@@ -26,7 +26,7 @@ from tracim_backend.exceptions import EmptyLabelNotAllowed
26 26
 from tracim_backend.models.context_models import ContentInContext
27 27
 from tracim_backend.models.context_models import RevisionInContext
28 28
 from tracim_backend.app_models.contents import CONTENT_TYPES
29
-from tracim_backend.app_models.contents import folder_type
29
+from tracim_backend.app_models.contents import FOLDER_TYPE
30 30
 from tracim_backend.models.revision_protection import new_revision
31 31
 
32 32
 SWAGGER_TAG__Folders_ENDPOINTS = 'Folders'
@@ -36,7 +36,7 @@ class FolderController(Controller):
36 36
 
37 37
     @hapic.with_api_doc(tags=[SWAGGER_TAG__Folders_ENDPOINTS])
38 38
     @require_workspace_role(UserRoleInWorkspace.READER)
39
-    @require_content_types([folder_type])
39
+    @require_content_types([FOLDER_TYPE])
40 40
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
41 41
     @hapic.output_body(TextBasedContentSchema())
42 42
     def get_folder(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext:  # nopep8
@@ -60,7 +60,7 @@ class FolderController(Controller):
60 60
     @hapic.with_api_doc(tags=[SWAGGER_TAG__Folders_ENDPOINTS])
61 61
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
62 62
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
63
-    @require_content_types([folder_type])
63
+    @require_content_types([FOLDER_TYPE])
64 64
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
65 65
     @hapic.input_body(FolderContentModifySchema())
66 66
     @hapic.output_body(TextBasedContentSchema())
@@ -100,7 +100,7 @@ class FolderController(Controller):
100 100
 
101 101
     @hapic.with_api_doc(tags=[SWAGGER_TAG__Folders_ENDPOINTS])
102 102
     @require_workspace_role(UserRoleInWorkspace.READER)
103
-    @require_content_types([folder_type])
103
+    @require_content_types([FOLDER_TYPE])
104 104
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
105 105
     @hapic.output_body(TextBasedRevisionSchema(many=True))
106 106
     def get_folder_revisions(
@@ -132,7 +132,7 @@ class FolderController(Controller):
132 132
 
133 133
     @hapic.with_api_doc(tags=[SWAGGER_TAG__Folders_ENDPOINTS])
134 134
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
135
-    @require_content_types([folder_type])
135
+    @require_content_types([FOLDER_TYPE])
136 136
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
137 137
     @hapic.input_body(SetContentStatusSchema())
138 138
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8

+ 5 - 5
backend/tracim_backend/views/contents_api/html_document_controller.py Visa fil

@@ -27,7 +27,7 @@ from tracim_backend.exceptions import EmptyLabelNotAllowed
27 27
 from tracim_backend.models.context_models import ContentInContext
28 28
 from tracim_backend.models.context_models import RevisionInContext
29 29
 from tracim_backend.app_models.contents import CONTENT_TYPES
30
-from tracim_backend.app_models.contents import html_documents_type
30
+from tracim_backend.app_models.contents import HTML_DOCUMENTS_TYPE
31 31
 from tracim_backend.models.revision_protection import new_revision
32 32
 
33 33
 SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS = 'HTML documents'
@@ -37,7 +37,7 @@ class HTMLDocumentController(Controller):
37 37
 
38 38
     @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
39 39
     @require_workspace_role(UserRoleInWorkspace.READER)
40
-    @require_content_types([html_documents_type])
40
+    @require_content_types([HTML_DOCUMENTS_TYPE])
41 41
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
42 42
     @hapic.output_body(TextBasedContentSchema())
43 43
     def get_html_document(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext:  # nopep8
@@ -61,7 +61,7 @@ class HTMLDocumentController(Controller):
61 61
     @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
62 62
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
63 63
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
64
-    @require_content_types([html_documents_type])
64
+    @require_content_types([HTML_DOCUMENTS_TYPE])
65 65
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
66 66
     @hapic.input_body(TextBasedContentModifySchema())
67 67
     @hapic.output_body(TextBasedContentSchema())
@@ -97,7 +97,7 @@ class HTMLDocumentController(Controller):
97 97
 
98 98
     @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
99 99
     @require_workspace_role(UserRoleInWorkspace.READER)
100
-    @require_content_types([html_documents_type])
100
+    @require_content_types([HTML_DOCUMENTS_TYPE])
101 101
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
102 102
     @hapic.output_body(TextBasedRevisionSchema(many=True))
103 103
     def get_html_document_revisions(
@@ -129,7 +129,7 @@ class HTMLDocumentController(Controller):
129 129
 
130 130
     @hapic.with_api_doc(tags=[SWAGGER_TAG__HTML_DOCUMENT_ENDPOINTS])
131 131
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
132
-    @require_content_types([html_documents_type])
132
+    @require_content_types([HTML_DOCUMENTS_TYPE])
133 133
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
134 134
     @hapic.input_body(SetContentStatusSchema())
135 135
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8

+ 5 - 5
backend/tracim_backend/views/contents_api/threads_controller.py Visa fil

@@ -26,7 +26,7 @@ from tracim_backend.exceptions import EmptyLabelNotAllowed
26 26
 from tracim_backend.models.context_models import ContentInContext
27 27
 from tracim_backend.models.context_models import RevisionInContext
28 28
 from tracim_backend.app_models.contents import CONTENT_TYPES
29
-from tracim_backend.app_models.contents import thread_type
29
+from tracim_backend.app_models.contents import THREAD_TYPE
30 30
 from tracim_backend.models.revision_protection import new_revision
31 31
 
32 32
 SWAGGER_TAG__THREAD_ENDPOINTS = 'Threads'
@@ -36,7 +36,7 @@ class ThreadController(Controller):
36 36
 
37 37
     @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
38 38
     @require_workspace_role(UserRoleInWorkspace.READER)
39
-    @require_content_types([thread_type])
39
+    @require_content_types([THREAD_TYPE])
40 40
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
41 41
     @hapic.output_body(TextBasedContentSchema())
42 42
     def get_thread(self, context, request: TracimRequest, hapic_data=None) -> ContentInContext:  # nopep8
@@ -60,7 +60,7 @@ class ThreadController(Controller):
60 60
     @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
61 61
     @hapic.handle_exception(EmptyLabelNotAllowed, HTTPStatus.BAD_REQUEST)
62 62
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
63
-    @require_content_types([thread_type])
63
+    @require_content_types([THREAD_TYPE])
64 64
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
65 65
     @hapic.input_body(TextBasedContentModifySchema())
66 66
     @hapic.output_body(TextBasedContentSchema())
@@ -96,7 +96,7 @@ class ThreadController(Controller):
96 96
 
97 97
     @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
98 98
     @require_workspace_role(UserRoleInWorkspace.READER)
99
-    @require_content_types([thread_type])
99
+    @require_content_types([THREAD_TYPE])
100 100
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
101 101
     @hapic.output_body(TextBasedRevisionSchema(many=True))
102 102
     def get_thread_revisions(
@@ -128,7 +128,7 @@ class ThreadController(Controller):
128 128
 
129 129
     @hapic.with_api_doc(tags=[SWAGGER_TAG__THREAD_ENDPOINTS])
130 130
     @require_workspace_role(UserRoleInWorkspace.CONTRIBUTOR)
131
-    @require_content_types([thread_type])
131
+    @require_content_types([THREAD_TYPE])
132 132
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
133 133
     @hapic.input_body(SetContentStatusSchema())
134 134
     @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT)  # nopep8

+ 7 - 7
backend/tracim_backend/views/core_api/schemas.py Visa fil

@@ -42,7 +42,7 @@ from tracim_backend.models.context_models import ContentFilter
42 42
 from tracim_backend.models.context_models import LoginCredentials
43 43
 from tracim_backend.models.data import UserRoleInWorkspace
44 44
 from tracim_backend.models.data import ActionDescription
45
-from tracim_backend.app_models.validator import ALL_CONTENT_TYPES_VALIDATOR
45
+from tracim_backend.app_models.validator import all_content_types_validator
46 46
 
47 47
 
48 48
 class UserDigestSchema(marshmallow.Schema):
@@ -392,7 +392,7 @@ class FilterContentQuerySchema(marshmallow.Schema):
392 392
     content_type = marshmallow.fields.String(
393 393
         example=CONTENT_TYPES.Any_SLUG,
394 394
         default=CONTENT_TYPES.Any_SLUG,
395
-        validate=ALL_CONTENT_TYPES_VALIDATOR
395
+        validate=all_content_types_validator
396 396
     )
397 397
 
398 398
     @post_load
@@ -643,7 +643,7 @@ class StatusSchema(marshmallow.Schema):
643 643
 class ContentTypeSchema(marshmallow.Schema):
644 644
     slug = marshmallow.fields.String(
645 645
         example='pagehtml',
646
-        validate=ALL_CONTENT_TYPES_VALIDATOR,
646
+        validate=all_content_types_validator,
647 647
     )
648 648
     fa_icon = marshmallow.fields.String(
649 649
         example='fa-file-text-o',
@@ -697,7 +697,7 @@ class ContentCreationSchema(marshmallow.Schema):
697 697
     )
698 698
     content_type = marshmallow.fields.String(
699 699
         example='html-document',
700
-        validate=ALL_CONTENT_TYPES_VALIDATOR,
700
+        validate=all_content_types_validator,
701 701
     )
702 702
     parent_id = marshmallow.fields.Integer(
703 703
         example=35,
@@ -732,12 +732,12 @@ class ContentDigestSchema(marshmallow.Schema):
732 732
     label = marshmallow.fields.Str(example='Intervention Report 12')
733 733
     content_type = marshmallow.fields.Str(
734 734
         example='html-document',
735
-        validate=ALL_CONTENT_TYPES_VALIDATOR,
735
+        validate=all_content_types_validator,
736 736
     )
737 737
     sub_content_types = marshmallow.fields.List(
738 738
         marshmallow.fields.String(
739 739
             example='html-content',
740
-            validate=ALL_CONTENT_TYPES_VALIDATOR
740
+            validate=all_content_types_validator
741 741
         ),
742 742
         description='list of content types allowed as sub contents. '
743 743
                     'This field is required for folder contents, '
@@ -887,7 +887,7 @@ class FolderContentModifySchema(ContentModifyAbstractSchema, TextBasedDataAbstra
887 887
     sub_content_types = marshmallow.fields.List(
888 888
         marshmallow.fields.String(
889 889
             example='html-document',
890
-            validate=ALL_CONTENT_TYPES_VALIDATOR,
890
+            validate=all_content_types_validator,
891 891
         ),
892 892
         description='list of content types allowed as sub contents. '
893 893
                     'This field is required for folder contents, '

+ 2 - 2
backend/tracim_backend/views/core_api/system_controller.py Visa fil

@@ -13,7 +13,7 @@ except ImportError:
13 13
     from http import client as HTTPStatus
14 14
 
15 15
 from tracim_backend.lib.utils.request import TracimRequest
16
-from tracim_backend.extensions import hapic, APP_LIST
16
+from tracim_backend.extensions import hapic, app_list
17 17
 from tracim_backend.views.controllers import Controller
18 18
 from tracim_backend.views.core_api.schemas import ApplicationSchema
19 19
 from tracim_backend.views.core_api.schemas import ContentTypeSchema
@@ -32,7 +32,7 @@ class SystemController(Controller):
32 32
         """
33 33
         app_config = request.registry.settings['CFG']
34 34
         app_api = ApplicationApi(
35
-            app_list=APP_LIST,
35
+            app_list=app_list,
36 36
         )
37 37
         return app_api.get_all()
38 38
 

+ 2 - 2
backend/tracim_backend/views/frontend.py Visa fil

@@ -2,7 +2,7 @@ import os
2 2
 
3 3
 from pyramid.renderers import render_to_response
4 4
 from pyramid.config import Configurator
5
-from tracim_backend.extensions import APP_LIST
5
+from tracim_backend.extensions import app_list
6 6
 from tracim_backend.exceptions import PageNotFound
7 7
 from tracim_backend.lib.core.application import ApplicationApi
8 8
 from tracim_backend.lib.utils.utils import Color
@@ -36,7 +36,7 @@ class FrontendController(Controller):
36 36
         # TODO - G.M - 2018-08-07 - Refactor autogen valid app list for frontend
37 37
         frontend_apps = []
38 38
         app_api = ApplicationApi(
39
-            app_list=APP_LIST,
39
+            app_list=app_list,
40 40
         )
41 41
         applications = app_api.get_all()
42 42
         for app in applications: