# HG changeset patch # User Christophe de Vienne # Date 1415308026 -3600 # Node ID 41bd2b3162284ce1671d907f7d6ec4d8fd0771bd # Parent 63d2c01fcb9490083fae652f17cf5eb75dae3d74 Move the cors middleware initialisation to pyramid-cubicweb to reduce code duplication diff -r 63d2c01fcb94 -r 41bd2b316228 __pkginfo__.py --- a/__pkginfo__.py Thu Oct 23 17:30:15 2014 +0200 +++ b/__pkginfo__.py Thu Nov 06 22:07:06 2014 +0100 @@ -13,7 +13,11 @@ description = "Add the 'pyramid' command to cubicweb-ctl" web = 'http://www.cubicweb.org/project/%s' % distname -__depends__ = {'cubicweb': '>= 3.19.3', 'wsgicors': '>= 0.3'} +__depends__ = { + 'cubicweb': '>= 3.19.3', + 'wsgicors': '>= 0.3', + 'pyramid-cubicweb': '>= 0.1.2' +} __recommends__ = {} classifiers = [ diff -r 63d2c01fcb94 -r 41bd2b316228 ccplugin.py --- a/ccplugin.py Thu Oct 23 17:30:15 2014 +0200 +++ b/ccplugin.py Thu Nov 06 22:07:06 2014 +0100 @@ -14,13 +14,11 @@ import threading import subprocess -import wsgicors - from cubicweb import BadCommandUsage, ExecutionError from cubicweb.cwconfig import CubicWebConfiguration as cwcfg from cubicweb.cwctl import CWCTL, InstanceCommand, init_cmdline_log_threshold -from pyramid_cubicweb import make_cubicweb_application +from pyramid_cubicweb import wsgi_application_from_cwconfig import waitress MAXFD = 1024 @@ -267,18 +265,7 @@ host = cwconfig['interface'] port = cwconfig['port'] or 8080 - pyramid_config = make_cubicweb_application(cwconfig) - - app = pyramid_config.make_wsgi_app() - - # This replaces completely web/cors.py, which is not used by - # pyramid_cubicweb anymore - app = wsgicors.CORS( - app, - origin=' '.join(cwconfig['access-control-allow-origin']), - headers=','.join(cwconfig['access-control-allow-headers']), - methods=','.join(cwconfig['access-control-allow-methods']), - credentials='true') + app = wsgi_application_from_cwconfig(cwconfig) repo = cwconfig.repository() try: