|
|
|
|
1
|
# -*- coding: utf-8 -*-
|
1
|
# -*- coding: utf-8 -*-
|
2
|
-import os
|
|
|
3
|
-
|
|
|
4
|
-from tracim_backend.views.frontend import FrontendController
|
|
|
5
|
-
|
|
|
6
|
try: # Python 3.5+
|
2
|
try: # Python 3.5+
|
7
|
from http import HTTPStatus
|
3
|
from http import HTTPStatus
|
8
|
except ImportError:
|
4
|
except ImportError:
|
|
|
|
|
11
|
from pyramid.config import Configurator
|
7
|
from pyramid.config import Configurator
|
12
|
from pyramid.authentication import BasicAuthAuthenticationPolicy
|
8
|
from pyramid.authentication import BasicAuthAuthenticationPolicy
|
13
|
from hapic.ext.pyramid import PyramidContext
|
9
|
from hapic.ext.pyramid import PyramidContext
|
14
|
-from pyramid.exceptions import NotFound
|
|
|
15
|
from sqlalchemy.exc import OperationalError
|
10
|
from sqlalchemy.exc import OperationalError
|
16
|
|
11
|
|
17
|
from tracim_backend.extensions import hapic
|
12
|
from tracim_backend.extensions import hapic
|
|
|
|
|
32
|
from tracim_backend.views.core_api.workspace_controller import WorkspaceController
|
27
|
from tracim_backend.views.core_api.workspace_controller import WorkspaceController
|
33
|
from tracim_backend.views.contents_api.comment_controller import CommentController
|
28
|
from tracim_backend.views.contents_api.comment_controller import CommentController
|
34
|
from tracim_backend.views.contents_api.file_controller import FileController
|
29
|
from tracim_backend.views.contents_api.file_controller import FileController
|
|
|
30
|
+from tracim_backend.views.frontend import FrontendController
|
35
|
from tracim_backend.views.errors import ErrorSchema
|
31
|
from tracim_backend.views.errors import ErrorSchema
|
36
|
from tracim_backend.exceptions import NotAuthenticated
|
32
|
from tracim_backend.exceptions import NotAuthenticated
|
|
|
33
|
+from tracim_backend.exceptions import PageNotFound
|
37
|
from tracim_backend.exceptions import UserNotActive
|
34
|
from tracim_backend.exceptions import UserNotActive
|
38
|
from tracim_backend.exceptions import InvalidId
|
35
|
from tracim_backend.exceptions import InvalidId
|
39
|
from tracim_backend.exceptions import InsufficientUserProfile
|
36
|
from tracim_backend.exceptions import InsufficientUserProfile
|
|
|
|
|
88
|
hapic.set_context(context)
|
85
|
hapic.set_context(context)
|
89
|
# INFO - G.M - 2018-07-04 - global-context exceptions
|
86
|
# INFO - G.M - 2018-07-04 - global-context exceptions
|
90
|
# Not found
|
87
|
# Not found
|
91
|
- context.handle_exception(NotFound, HTTPStatus.NOT_FOUND)
|
|
|
|
|
88
|
+ context.handle_exception(PageNotFound, HTTPStatus.NOT_FOUND)
|
92
|
# Bad request
|
89
|
# Bad request
|
93
|
context.handle_exception(WorkspaceNotFoundInTracimRequest, HTTPStatus.BAD_REQUEST) # nopep8
|
90
|
context.handle_exception(WorkspaceNotFoundInTracimRequest, HTTPStatus.BAD_REQUEST) # nopep8
|
94
|
context.handle_exception(UserNotFoundInTracimRequest, HTTPStatus.BAD_REQUEST) # nopep8
|
91
|
context.handle_exception(UserNotFoundInTracimRequest, HTTPStatus.BAD_REQUEST) # nopep8
|