Bladeren bron

convert slug page to html-documents

Guénaël Muller 6 jaren geleden
bovenliggende
commit
a05c27a786

+ 3 - 2
tracim/lib/utils/authorization.py Bestand weergeven

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
 import typing
2
 import typing
3
 from typing import TYPE_CHECKING
3
 from typing import TYPE_CHECKING
4
-
5
 import functools
4
 import functools
6
 from pyramid.interfaces import IAuthorizationPolicy
5
 from pyramid.interfaces import IAuthorizationPolicy
7
 from zope.interface import implementer
6
 from zope.interface import implementer
58
     :return:
57
     :return:
59
     """
58
     """
60
     def decorator(func):
59
     def decorator(func):
60
+        @functools.wraps(func)
61
         def wrapper(self, context, request: 'TracimRequest'):
61
         def wrapper(self, context, request: 'TracimRequest'):
62
             auth_user = request.current_user
62
             auth_user = request.current_user
63
             candidate_user = request.candidate_user
63
             candidate_user = request.candidate_user
78
     :return:
78
     :return:
79
     """
79
     """
80
     def decorator(func):
80
     def decorator(func):
81
+        @functools.wraps(func)
81
         def wrapper(self, context, request: 'TracimRequest'):
82
         def wrapper(self, context, request: 'TracimRequest'):
82
             user = request.current_user
83
             user = request.current_user
83
             if user.profile.id >= group:
84
             if user.profile.id >= group:
96
     :return: decorator
97
     :return: decorator
97
     """
98
     """
98
     def decorator(func):
99
     def decorator(func):
99
-
100
+        @functools.wraps(func)
100
         def wrapper(self, context, request: 'TracimRequest'):
101
         def wrapper(self, context, request: 'TracimRequest'):
101
             user = request.current_user
102
             user = request.current_user
102
             workspace = request.current_workspace
103
             workspace = request.current_workspace

+ 3 - 1
tracim/models/contents.py Bestand weergeven

160
 )
160
 )
161
 
161
 
162
 htmlpage_type = NewContentType(
162
 htmlpage_type = NewContentType(
163
-    slug='page',
163
+    slug='html-documents',
164
     fa_icon=htmlpage.fa_icon,
164
     fa_icon=htmlpage.fa_icon,
165
     hexcolor=htmlpage.hexcolor,
165
     hexcolor=htmlpage.hexcolor,
166
     label='Text Document',
166
     label='Text Document',
231
     MarkdownPage = markdownpluspage_type.slug
231
     MarkdownPage = markdownpluspage_type.slug
232
 
232
 
233
     def __init__(self, slug: str):
233
     def __init__(self, slug: str):
234
+        if slug == 'page':
235
+            slug = ContentTypeLegacy.Page
234
         for content_type in ALL_CONTENTS_DEFAULT_TYPES:
236
         for content_type in ALL_CONTENTS_DEFAULT_TYPES:
235
             if slug == content_type.slug:
237
             if slug == content_type.slug:
236
                 super(ContentTypeLegacy, self).__init__(
238
                 super(ContentTypeLegacy, self).__init__(

+ 8 - 8
tracim/tests/functional/test_contents.py Bestand weergeven

44
             status=200
44
             status=200
45
         )   # nopep8
45
         )   # nopep8
46
         content = res.json_body
46
         content = res.json_body
47
-        assert content['content_type'] == 'page'
47
+        assert content['content_type'] == 'html-documents'
48
         assert content['content_id'] == 6
48
         assert content['content_id'] == 6
49
         assert content['is_archived'] is False
49
         assert content['is_archived'] is False
50
         assert content['is_deleted'] is False
50
         assert content['is_deleted'] is False
90
             status=200
90
             status=200
91
         )
91
         )
92
         content = res.json_body
92
         content = res.json_body
93
-        assert content['content_type'] == 'page'
93
+        assert content['content_type'] == 'html-documents'
94
         assert content['content_id'] == 6
94
         assert content['content_id'] == 6
95
         assert content['is_archived'] is False
95
         assert content['is_archived'] is False
96
         assert content['is_deleted'] is False
96
         assert content['is_deleted'] is False
117
             status=200
117
             status=200
118
         )   # nopep8
118
         )   # nopep8
119
         content = res.json_body
119
         content = res.json_body
120
-        assert content['content_type'] == 'page'
120
+        assert content['content_type'] == 'html-documents'
121
         assert content['content_id'] == 6
121
         assert content['content_id'] == 6
122
         assert content['is_archived'] is False
122
         assert content['is_archived'] is False
123
         assert content['is_deleted'] is False
123
         assert content['is_deleted'] is False
159
         revisions = res.json_body
159
         revisions = res.json_body
160
         assert len(revisions) == 3
160
         assert len(revisions) == 3
161
         revision = revisions[0]
161
         revision = revisions[0]
162
-        assert revision['content_type'] == 'page'
162
+        assert revision['content_type'] == 'html-documents'
163
         assert revision['content_id'] == 6
163
         assert revision['content_id'] == 6
164
         assert revision['is_archived'] is False
164
         assert revision['is_archived'] is False
165
         assert revision['is_deleted'] is False
165
         assert revision['is_deleted'] is False
180
         assert revision['author']['avatar_url'] is None
180
         assert revision['author']['avatar_url'] is None
181
         assert revision['author']['public_name'] == 'Global manager'
181
         assert revision['author']['public_name'] == 'Global manager'
182
         revision = revisions[1]
182
         revision = revisions[1]
183
-        assert revision['content_type'] == 'page'
183
+        assert revision['content_type'] == 'html-documents'
184
         assert revision['content_id'] == 6
184
         assert revision['content_id'] == 6
185
         assert revision['is_archived'] is False
185
         assert revision['is_archived'] is False
186
         assert revision['is_deleted'] is False
186
         assert revision['is_deleted'] is False
201
         assert revision['author']['avatar_url'] is None
201
         assert revision['author']['avatar_url'] is None
202
         assert revision['author']['public_name'] == 'Global manager'
202
         assert revision['author']['public_name'] == 'Global manager'
203
         revision = revisions[2]
203
         revision = revisions[2]
204
-        assert revision['content_type'] == 'page'
204
+        assert revision['content_type'] == 'html-documents'
205
         assert revision['content_id'] == 6
205
         assert revision['content_id'] == 6
206
         assert revision['is_archived'] is False
206
         assert revision['is_archived'] is False
207
         assert revision['is_deleted'] is False
207
         assert revision['is_deleted'] is False
243
             status=200
243
             status=200
244
         )   # nopep8
244
         )   # nopep8
245
         content = res.json_body
245
         content = res.json_body
246
-        assert content['content_type'] == 'page'
246
+        assert content['content_type'] == 'html-documents'
247
         assert content['content_id'] == 6
247
         assert content['content_id'] == 6
248
         assert content['status'] == 'open'
248
         assert content['status'] == 'open'
249
 
249
 
260
             status=200
260
             status=200
261
         )   # nopep8
261
         )   # nopep8
262
         content = res.json_body
262
         content = res.json_body
263
-        assert content['content_type'] == 'page'
263
+        assert content['content_type'] == 'html-documents'
264
         assert content['content_id'] == 6
264
         assert content['content_id'] == 6
265
         assert content['status'] == 'closed-deprecated'
265
         assert content['status'] == 'closed-deprecated'
266
 
266
 

+ 1 - 1
tracim/tests/functional/test_system.py Bestand weergeven

124
         assert len(content_type['available_statuses']) == 4
124
         assert len(content_type['available_statuses']) == 4
125
 
125
 
126
         content_type = res[3]
126
         content_type = res[3]
127
-        assert content_type['slug'] == 'page'
127
+        assert content_type['slug'] == 'html-documents'
128
         assert content_type['fa_icon'] == 'file-text-o'
128
         assert content_type['fa_icon'] == 'file-text-o'
129
         assert content_type['hexcolor'] == '#3f52e3'
129
         assert content_type['hexcolor'] == '#3f52e3'
130
         assert content_type['label'] == 'Text Document'
130
         assert content_type['label'] == 'Text Document'

+ 26 - 26
tracim/tests/functional/test_workspaces.py Bestand weergeven

247
         assert content['show_in_ui'] is True
247
         assert content['show_in_ui'] is True
248
         assert content['slug'] == 'tools'
248
         assert content['slug'] == 'tools'
249
         assert content['status'] == 'open'
249
         assert content['status'] == 'open'
250
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
250
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
251
         assert content['workspace_id'] == 1
251
         assert content['workspace_id'] == 1
252
         content = res[1]
252
         content = res[1]
253
         assert content['content_id'] == 2
253
         assert content['content_id'] == 2
258
         assert content['show_in_ui'] is True
258
         assert content['show_in_ui'] is True
259
         assert content['slug'] == 'menus'
259
         assert content['slug'] == 'menus'
260
         assert content['status'] == 'open'
260
         assert content['status'] == 'open'
261
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
261
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
262
         assert content['workspace_id'] == 1
262
         assert content['workspace_id'] == 1
263
         content = res[2]
263
         content = res[2]
264
         assert content['content_id'] == 11
264
         assert content['content_id'] == 11
269
         assert content['show_in_ui'] is True
269
         assert content['show_in_ui'] is True
270
         assert content['slug'] == 'current-menu'
270
         assert content['slug'] == 'current-menu'
271
         assert content['status'] == 'open'
271
         assert content['status'] == 'open'
272
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
272
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
273
         assert content['workspace_id'] == 1
273
         assert content['workspace_id'] == 1
274
 
274
 
275
     # Root related
275
     # Root related
299
         # TODO - G.M - 30-05-2018 - Check this test
299
         # TODO - G.M - 30-05-2018 - Check this test
300
         assert len(res) == 4
300
         assert len(res) == 4
301
         content = res[1]
301
         content = res[1]
302
-        assert content['content_type'] == 'page'
302
+        assert content['content_type'] == 'html-documents'
303
         assert content['content_id'] == 15
303
         assert content['content_id'] == 15
304
         assert content['is_archived'] is False
304
         assert content['is_archived'] is False
305
         assert content['is_deleted'] is False
305
         assert content['is_deleted'] is False
308
         assert content['show_in_ui'] is True
308
         assert content['show_in_ui'] is True
309
         assert content['slug'] == 'new-fruit-salad'
309
         assert content['slug'] == 'new-fruit-salad'
310
         assert content['status'] == 'open'
310
         assert content['status'] == 'open'
311
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
311
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
312
         assert content['workspace_id'] == 3
312
         assert content['workspace_id'] == 3
313
 
313
 
314
         content = res[2]
314
         content = res[2]
315
-        assert content['content_type'] == 'page'
315
+        assert content['content_type'] == 'html-documents'
316
         assert content['content_id'] == 16
316
         assert content['content_id'] == 16
317
         assert content['is_archived'] is True
317
         assert content['is_archived'] is True
318
         assert content['is_deleted'] is False
318
         assert content['is_deleted'] is False
321
         assert content['show_in_ui'] is True
321
         assert content['show_in_ui'] is True
322
         assert content['slug'].startswith('fruit-salad')
322
         assert content['slug'].startswith('fruit-salad')
323
         assert content['status'] == 'open'
323
         assert content['status'] == 'open'
324
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
324
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
325
         assert content['workspace_id'] == 3
325
         assert content['workspace_id'] == 3
326
 
326
 
327
         content = res[3]
327
         content = res[3]
328
-        assert content['content_type'] == 'page'
328
+        assert content['content_type'] == 'html-documents'
329
         assert content['content_id'] == 17
329
         assert content['content_id'] == 17
330
         assert content['is_archived'] is False
330
         assert content['is_archived'] is False
331
         assert content['is_deleted'] is True
331
         assert content['is_deleted'] is True
334
         assert content['show_in_ui'] is True
334
         assert content['show_in_ui'] is True
335
         assert content['slug'].startswith('bad-fruit-salad')
335
         assert content['slug'].startswith('bad-fruit-salad')
336
         assert content['status'] == 'open'
336
         assert content['status'] == 'open'
337
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
337
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
338
         assert content['workspace_id'] == 3
338
         assert content['workspace_id'] == 3
339
 
339
 
340
     def test_api__get_workspace_content__ok_200__get_only_active_root_content(self):  # nopep8
340
     def test_api__get_workspace_content__ok_200__get_only_active_root_content(self):  # nopep8
362
         # TODO - G.M - 30-05-2018 - Check this test
362
         # TODO - G.M - 30-05-2018 - Check this test
363
         assert len(res) == 2
363
         assert len(res) == 2
364
         content = res[1]
364
         content = res[1]
365
-        assert content['content_type'] == 'page'
365
+        assert content['content_type'] == 'html-documents'
366
         assert content['content_id'] == 15
366
         assert content['content_id'] == 15
367
         assert content['is_archived'] is False
367
         assert content['is_archived'] is False
368
         assert content['is_deleted'] is False
368
         assert content['is_deleted'] is False
371
         assert content['show_in_ui'] is True
371
         assert content['show_in_ui'] is True
372
         assert content['slug'] == 'new-fruit-salad'
372
         assert content['slug'] == 'new-fruit-salad'
373
         assert content['status'] == 'open'
373
         assert content['status'] == 'open'
374
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
374
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
375
         assert content['workspace_id'] == 3
375
         assert content['workspace_id'] == 3
376
 
376
 
377
     def test_api__get_workspace_content__ok_200__get_only_archived_root_content(self):  # nopep8
377
     def test_api__get_workspace_content__ok_200__get_only_archived_root_content(self):  # nopep8
398
         ).json_body   # nopep8
398
         ).json_body   # nopep8
399
         assert len(res) == 1
399
         assert len(res) == 1
400
         content = res[0]
400
         content = res[0]
401
-        assert content['content_type'] == 'page'
401
+        assert content['content_type'] == 'html-documents'
402
         assert content['content_id'] == 16
402
         assert content['content_id'] == 16
403
         assert content['is_archived'] is True
403
         assert content['is_archived'] is True
404
         assert content['is_deleted'] is False
404
         assert content['is_deleted'] is False
407
         assert content['show_in_ui'] is True
407
         assert content['show_in_ui'] is True
408
         assert content['slug'].startswith('fruit-salad')
408
         assert content['slug'].startswith('fruit-salad')
409
         assert content['status'] == 'open'
409
         assert content['status'] == 'open'
410
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
410
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
411
         assert content['workspace_id'] == 3
411
         assert content['workspace_id'] == 3
412
 
412
 
413
     def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self):  # nopep8
413
     def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self):  # nopep8
436
 
436
 
437
         assert len(res) == 1
437
         assert len(res) == 1
438
         content = res[0]
438
         content = res[0]
439
-        assert content['content_type'] == 'page'
439
+        assert content['content_type'] == 'html-documents'
440
         assert content['content_id'] == 17
440
         assert content['content_id'] == 17
441
         assert content['is_archived'] is False
441
         assert content['is_archived'] is False
442
         assert content['is_deleted'] is True
442
         assert content['is_deleted'] is True
445
         assert content['show_in_ui'] is True
445
         assert content['show_in_ui'] is True
446
         assert content['slug'].startswith('bad-fruit-salad')
446
         assert content['slug'].startswith('bad-fruit-salad')
447
         assert content['status'] == 'open'
447
         assert content['status'] == 'open'
448
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
448
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
449
         assert content['workspace_id'] == 3
449
         assert content['workspace_id'] == 3
450
 
450
 
451
     def test_api__get_workspace_content__ok_200__get_nothing_root_content(self):
451
     def test_api__get_workspace_content__ok_200__get_nothing_root_content(self):
500
         ).json_body   # nopep8
500
         ).json_body   # nopep8
501
         assert len(res) == 3
501
         assert len(res) == 3
502
         content = res[0]
502
         content = res[0]
503
-        assert content['content_type'] == 'page'
503
+        assert content['content_type'] == 'html-documents'
504
         assert content['content_id'] == 12
504
         assert content['content_id'] == 12
505
         assert content['is_archived'] is False
505
         assert content['is_archived'] is False
506
         assert content['is_deleted'] is False
506
         assert content['is_deleted'] is False
509
         assert content['show_in_ui'] is True
509
         assert content['show_in_ui'] is True
510
         assert content['slug'] == 'new-fruit-salad'
510
         assert content['slug'] == 'new-fruit-salad'
511
         assert content['status'] == 'open'
511
         assert content['status'] == 'open'
512
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
512
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
513
         assert content['workspace_id'] == 2
513
         assert content['workspace_id'] == 2
514
 
514
 
515
         content = res[1]
515
         content = res[1]
516
-        assert content['content_type'] == 'page'
516
+        assert content['content_type'] == 'html-documents'
517
         assert content['content_id'] == 13
517
         assert content['content_id'] == 13
518
         assert content['is_archived'] is True
518
         assert content['is_archived'] is True
519
         assert content['is_deleted'] is False
519
         assert content['is_deleted'] is False
522
         assert content['show_in_ui'] is True
522
         assert content['show_in_ui'] is True
523
         assert content['slug'].startswith('fruit-salad')
523
         assert content['slug'].startswith('fruit-salad')
524
         assert content['status'] == 'open'
524
         assert content['status'] == 'open'
525
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
525
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
526
         assert content['workspace_id'] == 2
526
         assert content['workspace_id'] == 2
527
 
527
 
528
         content = res[2]
528
         content = res[2]
529
-        assert content['content_type'] == 'page'
529
+        assert content['content_type'] == 'html-documents'
530
         assert content['content_id'] == 14
530
         assert content['content_id'] == 14
531
         assert content['is_archived'] is False
531
         assert content['is_archived'] is False
532
         assert content['is_deleted'] is True
532
         assert content['is_deleted'] is True
535
         assert content['show_in_ui'] is True
535
         assert content['show_in_ui'] is True
536
         assert content['slug'].startswith('bad-fruit-salad')
536
         assert content['slug'].startswith('bad-fruit-salad')
537
         assert content['status'] == 'open'
537
         assert content['status'] == 'open'
538
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
538
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
539
         assert content['workspace_id'] == 2
539
         assert content['workspace_id'] == 2
540
 
540
 
541
     def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self):  # nopep8
541
     def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self):  # nopep8
571
         assert content['show_in_ui'] is True
571
         assert content['show_in_ui'] is True
572
         assert content['slug'] == 'new-fruit-salad'
572
         assert content['slug'] == 'new-fruit-salad'
573
         assert content['status'] == 'open'
573
         assert content['status'] == 'open'
574
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
574
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
575
         assert content['workspace_id'] == 2
575
         assert content['workspace_id'] == 2
576
 
576
 
577
     def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self):  # nopep8
577
     def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self):  # nopep8
598
         ).json_body   # nopep8
598
         ).json_body   # nopep8
599
         assert len(res) == 1
599
         assert len(res) == 1
600
         content = res[0]
600
         content = res[0]
601
-        assert content['content_type'] == 'page'
601
+        assert content['content_type'] == 'html-documents'
602
         assert content['content_id'] == 13
602
         assert content['content_id'] == 13
603
         assert content['is_archived'] is True
603
         assert content['is_archived'] is True
604
         assert content['is_deleted'] is False
604
         assert content['is_deleted'] is False
607
         assert content['show_in_ui'] is True
607
         assert content['show_in_ui'] is True
608
         assert content['slug'].startswith('fruit-salad')
608
         assert content['slug'].startswith('fruit-salad')
609
         assert content['status'] == 'open'
609
         assert content['status'] == 'open'
610
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
610
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
611
         assert content['workspace_id'] == 2
611
         assert content['workspace_id'] == 2
612
 
612
 
613
     def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self):  # nopep8
613
     def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self):  # nopep8
635
 
635
 
636
         assert len(res) == 1
636
         assert len(res) == 1
637
         content = res[0]
637
         content = res[0]
638
-        assert content['content_type'] == 'page'
638
+        assert content['content_type'] == 'html-documents'
639
         assert content['content_id'] == 14
639
         assert content['content_id'] == 14
640
         assert content['is_archived'] is False
640
         assert content['is_archived'] is False
641
         assert content['is_deleted'] is True
641
         assert content['is_deleted'] is True
644
         assert content['show_in_ui'] is True
644
         assert content['show_in_ui'] is True
645
         assert content['slug'].startswith('bad-fruit-salad')
645
         assert content['slug'].startswith('bad-fruit-salad')
646
         assert content['status'] == 'open'
646
         assert content['status'] == 'open'
647
-        assert set(content['sub_content_types']) == {'thread', 'page', 'folder', 'file'}  # nopep8
647
+        assert set(content['sub_content_types']) == {'thread', 'html-documents', 'folder', 'file'}  # nopep8
648
         assert content['workspace_id'] == 2
648
         assert content['workspace_id'] == 2
649
 
649
 
650
     def test_api__get_workspace_content__ok_200__get_nothing_folder_content(self):  # nopep8
650
     def test_api__get_workspace_content__ok_200__get_nothing_folder_content(self):  # nopep8

+ 1 - 1
tracim/views/core_api/system_controller.py Bestand weergeven

40
     @hapic.output_body(ContentTypeSchema(many=True),)
40
     @hapic.output_body(ContentTypeSchema(many=True),)
41
     def content_types(self, context, request: TracimRequest, hapic_data=None):
41
     def content_types(self, context, request: TracimRequest, hapic_data=None):
42
         """
42
         """
43
-        Get list of alls applications installed in this tracim instance.
43
+        Get list of alls content types availables in this tracim instance.
44
         """
44
         """
45
 
45
 
46
         return CONTENT_DEFAULT_TYPE
46
         return CONTENT_DEFAULT_TYPE

+ 2 - 2
tracim/views/core_api/user_controller.py Bestand weergeven

20
 from tracim.views.core_api.schemas import UserIdPathSchema
20
 from tracim.views.core_api.schemas import UserIdPathSchema
21
 from tracim.views.core_api.schemas import WorkspaceDigestSchema
21
 from tracim.views.core_api.schemas import WorkspaceDigestSchema
22
 
22
 
23
-USERS_ENDPOINTS_TAG = 'Users'
23
+USER_ENDPOINTS_TAG = 'Users'
24
 
24
 
25
 
25
 
26
 class UserController(Controller):
26
 class UserController(Controller):
27
 
27
 
28
-    @hapic.with_api_doc(tags=[USERS_ENDPOINTS_TAG])
28
+    @hapic.with_api_doc(tags=[USER_ENDPOINTS_TAG])
29
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
29
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
30
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
30
     @hapic.handle_exception(InsufficientUserProfile, HTTPStatus.FORBIDDEN)
31
     @hapic.handle_exception(UserDoesNotExist, HTTPStatus.NOT_FOUND)
31
     @hapic.handle_exception(UserDoesNotExist, HTTPStatus.NOT_FOUND)

+ 11 - 11
tracim/views/core_api/workspace_controller.py Bestand weergeven

34
 from tracim.models.contents import ContentTypeLegacy as ContentType
34
 from tracim.models.contents import ContentTypeLegacy as ContentType
35
 from tracim.models.revision_protection import new_revision
35
 from tracim.models.revision_protection import new_revision
36
 
36
 
37
-WORKSPACES_ENDPOINTS_TAG = 'Workspaces'
37
+WORKSPACE_ENDPOINTS_TAG = 'Workspaces'
38
 
38
 
39
 
39
 
40
 class WorkspaceController(Controller):
40
 class WorkspaceController(Controller):
41
 
41
 
42
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
42
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
43
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
43
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
44
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
44
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
45
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
45
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
59
         )
59
         )
60
         return wapi.get_workspace_with_context(request.current_workspace)
60
         return wapi.get_workspace_with_context(request.current_workspace)
61
 
61
 
62
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
62
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
63
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
63
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
64
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
64
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
65
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
65
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
88
             for user_role in roles
88
             for user_role in roles
89
         ]
89
         ]
90
 
90
 
91
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
91
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
92
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
92
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
93
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
93
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
94
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
94
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
124
         ]
124
         ]
125
         return contents
125
         return contents
126
 
126
 
127
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
127
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
128
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
128
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
129
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
129
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
130
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
130
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
157
         content = api.get_content_in_context(content)
157
         content = api.get_content_in_context(content)
158
         return content
158
         return content
159
 
159
 
160
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
160
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
161
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
161
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
162
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
162
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
163
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
163
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
166
     @require_candidate_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
166
     @require_candidate_workspace_role(UserRoleInWorkspace.CONTENT_MANAGER)
167
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
167
     @hapic.input_path(WorkspaceAndContentIdPathSchema())
168
     @hapic.input_body(ContentMoveSchema())
168
     @hapic.input_body(ContentMoveSchema())
169
-    @hapic.output_body(ContentDigestSchema())  # nopep8
169
+    @hapic.output_body(ContentDigestSchema())
170
     def move_content(
170
     def move_content(
171
             self,
171
             self,
172
             context,
172
             context,
212
         )
212
         )
213
         return api.get_content_in_context(updated_content)
213
         return api.get_content_in_context(updated_content)
214
 
214
 
215
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
215
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
216
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
216
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
217
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
217
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
218
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
218
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
247
             api.delete(content)
247
             api.delete(content)
248
         return
248
         return
249
 
249
 
250
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
250
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
251
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
251
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
252
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
252
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
253
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
253
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
283
             api.undelete(content)
283
             api.undelete(content)
284
         return
284
         return
285
 
285
 
286
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
286
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
287
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
287
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
288
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
288
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
289
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
289
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
315
             api.archive(content)
315
             api.archive(content)
316
         return
316
         return
317
 
317
 
318
-    @hapic.with_api_doc(tags=[WORKSPACES_ENDPOINTS_TAG])
318
+    @hapic.with_api_doc(tags=[WORKSPACE_ENDPOINTS_TAG])
319
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
319
     @hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
320
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
320
     @hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
321
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)
321
     @hapic.handle_exception(WorkspaceNotFound, HTTPStatus.FORBIDDEN)