simplifier le global_layout

This commit is contained in:
2020-08-18 17:17:56 +02:00
parent 44986cd5f4
commit a46587d637
27 changed files with 75 additions and 75 deletions

View File

@@ -9,10 +9,6 @@ from pyramid.security import (
DENY_ALL,
)
# run configure_mappers after defining all of the models to ensure
# all relationships can be setup
configure_mappers()
class RootFactory(object):
"""Defines an ACL for groups/permissions mapping"""
__acl__ = [ (Allow, Authenticated, 'view'),
@@ -22,6 +18,10 @@ class RootFactory(object):
def __init__(self, request):
pass
# run configure_mappers after defining all of the models to ensure
# all relationships can be setup
configure_mappers()
def get_engine(settings, prefix='sqlalchemy.'):
return engine_from_config(settings, prefix)
@@ -64,14 +64,18 @@ def includeme(config):
"""
Initialize the model for a Pyramid app.
Activate this setup using ``config.include('mondumas.models')``.
Activate this setup using ``config.include('caotek_mesavoirs.models')``.
"""
settings = config.get_settings()
settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
# use pyramid_tm to hook the transaction lifecycle to the request
config.include('pyramid_tm')
# use pyramid_retry to retry a request when transient exceptions occur
config.include('pyramid_retry')
session_factory = get_session_factory(get_engine(settings))
config.registry['dbsession_factory'] = session_factory