Skip to content
This repository was archived by the owner on Oct 24, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'zope.sqlalchemy',
'alembic',
# API
'hapic',
'hapic>=0.41',
'marshmallow <3.0.0a1,>2.0.0',
# CLI
'cliff',
Expand Down
15 changes: 10 additions & 5 deletions tracim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyramid.config import Configurator
from pyramid.authentication import BasicAuthAuthenticationPolicy
from hapic.ext.pyramid import PyramidContext
from pyramid.exceptions import NotFound
from sqlalchemy.exc import OperationalError

from tracim.extensions import hapic
from tracim.config import CFG
Expand Down Expand Up @@ -49,12 +51,15 @@ def main(global_config, **settings):
# Add SqlAlchemy DB
configurator.include('.models')
# set Hapic
hapic.set_context(
PyramidContext(
configurator=configurator,
default_error_builder=ErrorSchema()
)
context = PyramidContext(
configurator=configurator,
default_error_builder=ErrorSchema(),
debug=app_config.DEBUG,
)
hapic.set_context(context)
context.handle_exception(NotFound, 404)
context.handle_exception(OperationalError, 500)
context.handle_exception(Exception, 500)
# Add controllers
session_api = SessionController()
configurator.include(session_api.bind, route_prefix=BASE_API_V2)
Expand Down
1 change: 1 addition & 0 deletions tracim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def __init__(self, settings):
'604800',
))

self.DEBUG = asbool(settings.get('debug', False))
# TODO - G.M - 27-03-2018 - [Email] Restore email config
###
# EMAIL related stuff (notification, reply)
Expand Down
2 changes: 0 additions & 2 deletions tracim/tests/functional/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ def test_api__access_logout_post_enpoint__ok__nominal_case(self):

class TestLoginEndpointUnititedDB(FunctionalTestNoDB):

@pytest.mark.xfail(raises=OperationalError,
reason='Not supported yet by hapic')
def test_api__try_login_enpoint__err_500__no_inited_db(self):
params = {
'email': 'admin@admin.admin',
Expand Down