[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.
--- 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.
--- 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()
--- 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
--- 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,
)
--- 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',