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