[py3] import configparser from six.moves instead of using a try/except 3.26
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 05 Mar 2019 13:52:52 +0100
branch3.26
changeset 12419 e034454af0d5
parent 12377 15a068b2def5
child 12420 1c0dce14c3b5
[py3] import configparser from six.moves instead of using a try/except Using six is better than the try/except because it clearly indicates compatibility code. Also, when using tools such as vermin which relies on AST, it helps getting rid of false compatibility errors.
cubicweb/pyramid/__init__.py
--- a/cubicweb/pyramid/__init__.py	Wed Feb 13 14:40:39 2019 +0100
+++ b/cubicweb/pyramid/__init__.py	Tue Mar 05 13:52:52 2019 +0100
@@ -24,6 +24,7 @@
 import os
 import warnings
 
+from six.moves.configparser import SafeConfigParser
 import wsgicors
 
 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
@@ -31,11 +32,6 @@
 from pyramid.exceptions import ConfigurationError
 from pyramid.settings import asbool, aslist
 
-try:
-    from configparser import SafeConfigParser
-except ImportError:
-    from ConfigParser import SafeConfigParser
-
 
 def config_from_cwconfig(cwconfig, settings=None):
     """Return a Pyramid Configurator instance built from a CubicWeb config and