[pyramid] Only expose 'cubicweb.bwcompat' setting for "all-in-one" configuration type 3.25
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 06 Jun 2017 12:20:17 +0200
branch3.25
changeset 12186 36f1c7ab9010
parent 12185 c46f2bf815d2
child 12190 5fe62978801a
[pyramid] Only expose 'cubicweb.bwcompat' setting for "all-in-one" configuration type The "pyramid" instance configuration does not work with "cubiwceb.bwcompat" mode (on purpose). Yet, having the setting exposed in development.ini file (generate by `cubicweb-ctl create --config pyramid <cube> <instance>` command) is misleading and we want to remove it. Thus, we only query this setting when cubicweb configuration is "all-in-one" and drop the setting line from templated development.ini file. If the option is found and True for any other configuration type, we issue a user warning (and ignore the option).
cubicweb/pyramid/__init__.py
cubicweb/pyramid/development.ini.tmpl
doc/book/pyramid/settings.rst
--- a/cubicweb/pyramid/__init__.py	Thu Apr 27 10:16:39 2017 +0200
+++ b/cubicweb/pyramid/__init__.py	Tue Jun 06 12:20:17 2017 +0200
@@ -22,6 +22,7 @@
 
 import atexit
 import os
+import warnings
 
 import wsgicors
 
@@ -240,5 +241,11 @@
 
     config.include('cubicweb.pyramid.core')
 
-    if asbool(config.registry.settings.get('cubicweb.bwcompat', True)):
-        config.include('cubicweb.pyramid.bwcompat')
+    if asbool(config.registry.settings.get('cubicweb.bwcompat',
+                                           cwconfig.name == 'all-in-one')):
+        if cwconfig.name != 'all-in-one':
+            warnings.warn('"cubicweb.bwcompat" setting only applies to '
+                          '"all-in-one" instance configuration',
+                          UserWarning)
+        else:
+            config.include('cubicweb.pyramid.bwcompat')
--- a/cubicweb/pyramid/development.ini.tmpl	Thu Apr 27 10:16:39 2017 +0200
+++ b/cubicweb/pyramid/development.ini.tmpl	Tue Jun 06 12:20:17 2017 +0200
@@ -23,7 +23,6 @@
 # http://cubicweb.readthedocs.io/en/latest/book/pyramid/settings/
 ##
 cubicweb.instance = %(instance)s
-cubicweb.bwcompat = false
 cubicweb.debug = true
 cubicweb.session.secret = %(session-secret)s
 cubicweb.auth.authtkt.persistent.secure = false
--- a/doc/book/pyramid/settings.rst	Thu Apr 27 10:16:39 2017 +0200
+++ b/doc/book/pyramid/settings.rst	Tue Jun 06 12:20:17 2017 +0200
@@ -76,7 +76,10 @@
 
 .. confval:: cubicweb.bwcompat (bool)
 
-    (True) Enable/disable backward compatibility. See :ref:`bwcompat_module`.
+    (True) Enable/disable backward compatibility. This only applies to
+    "all-in-one" configuration type.
+
+    See :ref:`bwcompat_module`.
 
 .. confval:: cubicweb.bwcompat.errorhandler (bool)