# HG changeset patch # User Denis Laxalde # Date 1487663660 -3600 # Node ID bb0dfc7d2d0e2b11e28a8e4b1b19edb9b59ad6c3 # Parent 83739be20fab0bf7060c13c4b79aaf89386c7ed4 [skeleton,pyramid] Move pyramid app definition in cubicweb.pyramid module The application definition is actually not specific to the final "cube" being bootstrapped from skeleton. This patch thus move the pyramid application function into cubicweb.pyramid module and let cubicweb register the "paste.app_factory" entry point (instead of the bootstrapped cube). Useless call to `config.scan` is dropped along the way. diff -r 83739be20fab -r bb0dfc7d2d0e cubicweb/pyramid/__init__.py --- a/cubicweb/pyramid/__init__.py Fri Feb 10 17:13:44 2017 +0100 +++ b/cubicweb/pyramid/__init__.py Tue Feb 21 08:54:20 2017 +0100 @@ -166,6 +166,13 @@ return wsgi_application_from_cwconfig(cwconfig) +def pyramid_app(global_config, **settings): + """Return a Pyramid WSGI application bound to a CubicWeb repository.""" + config = Configurator(settings=settings) + config.include('cubicweb.pyramid') + return config.make_wsgi_app() + + def includeme(config): """Set-up a CubicWeb instance. diff -r 83739be20fab -r bb0dfc7d2d0e cubicweb/skeleton/cubicweb_CUBENAME/__init__.py.tmpl --- a/cubicweb/skeleton/cubicweb_CUBENAME/__init__.py.tmpl Fri Feb 10 17:13:44 2017 +0100 +++ b/cubicweb/skeleton/cubicweb_CUBENAME/__init__.py.tmpl Tue Feb 21 08:54:20 2017 +0100 @@ -2,12 +2,3 @@ %(longdesc)s """ - - -def pyramid_main(global_config, **settings): - """Return a Pyramid WSGI application bound to a CubicWeb repository.""" - from pyramid.config import Configurator - config = Configurator(settings=settings) - config.include('cubicweb.pyramid') - config.scan() - return config.make_wsgi_app() diff -r 83739be20fab -r bb0dfc7d2d0e cubicweb/skeleton/development.ini.tmpl --- a/cubicweb/skeleton/development.ini.tmpl Fri Feb 10 17:13:44 2017 +0100 +++ b/cubicweb/skeleton/development.ini.tmpl Tue Feb 21 08:54:20 2017 +0100 @@ -4,7 +4,7 @@ ### [app:main] -use = egg:%(distname)s +use = egg:cubicweb#main pyramid.reload_templates = true pyramid.debug_authorization = false diff -r 83739be20fab -r bb0dfc7d2d0e cubicweb/skeleton/setup.py.tmpl --- a/cubicweb/skeleton/setup.py.tmpl Fri Feb 10 17:13:44 2017 +0100 +++ b/cubicweb/skeleton/setup.py.tmpl Tue Feb 21 08:54:20 2017 +0100 @@ -77,9 +77,6 @@ 'cubicweb.cubes': [ '%(cubename)s=cubicweb_%(cubename)s', ], - 'paste.app_factory': [ - 'main=cubicweb_%(cubename)s:pyramid_main', - ], }, zip_safe=False, ) diff -r 83739be20fab -r bb0dfc7d2d0e setup.py --- a/setup.py Fri Feb 10 17:13:44 2017 +0100 +++ b/setup.py Tue Feb 21 08:54:20 2017 +0100 @@ -204,6 +204,11 @@ 'Markdown', 'unittest2 >= 0.7.0', ], + entry_points={ + 'paste.app_factory': [ + 'main=cubicweb.pyramid:pyramid_app', + ], + }, extras_require={ 'captcha': [ 'Pillow',