[etwist] Drop try/except around definitions of 'all-in-one' configuration and command handlers
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 27 Feb 2017 08:53:52 +0100
changeset 11989 309cf6a2c24f
parent 11988 ffde65347797
child 11990 18aafce99b49
[etwist] Drop try/except around definitions of 'all-in-one' configuration and command handlers cubicweb.server is no longer conditionally shipped, neither in python package nor in debian package since 3.24.
cubicweb/etwist/twconfig.py
cubicweb/etwist/twctl.py
--- a/cubicweb/etwist/twconfig.py	Tue Feb 28 16:55:32 2017 +0100
+++ b/cubicweb/etwist/twconfig.py	Mon Feb 27 08:53:52 2017 +0100
@@ -28,6 +28,7 @@
 from logilab.common.configuration import Method, merge_options
 
 from cubicweb.cwconfig import CONFIGURATIONS
+from cubicweb.server.serverconfig import ServerConfiguration
 from cubicweb.web.webconfig import WebConfiguration
 
 
@@ -96,20 +97,14 @@
         return 'http://%s:%s/' % (self['host'] or getfqdn().lower(), self['port'] or 8080)
 
 
-try:
-    from cubicweb.server.serverconfig import ServerConfiguration
+class AllInOneConfiguration(WebConfigurationBase, ServerConfiguration):
+    """repository and web instance in the same twisted process"""
+    name = 'all-in-one'
+    options = merge_options(WebConfigurationBase.options
+                            + ServerConfiguration.options)
 
-    class AllInOneConfiguration(WebConfigurationBase, ServerConfiguration):
-        """repository and web instance in the same twisted process"""
-        name = 'all-in-one'
-        options = merge_options(WebConfigurationBase.options
-                                + ServerConfiguration.options)
-
-        cubicweb_appobject_path = WebConfigurationBase.cubicweb_appobject_path | ServerConfiguration.cubicweb_appobject_path
-        cube_appobject_path = WebConfigurationBase.cube_appobject_path | ServerConfiguration.cube_appobject_path
+    cubicweb_appobject_path = WebConfigurationBase.cubicweb_appobject_path | ServerConfiguration.cubicweb_appobject_path
+    cube_appobject_path = WebConfigurationBase.cube_appobject_path | ServerConfiguration.cube_appobject_path
 
 
-    CONFIGURATIONS.append(AllInOneConfiguration)
-
-except ImportError:
-    pass
+CONFIGURATIONS.append(AllInOneConfiguration)
--- a/cubicweb/etwist/twctl.py	Tue Feb 28 16:55:32 2017 +0100
+++ b/cubicweb/etwist/twctl.py	Mon Feb 27 08:53:52 2017 +0100
@@ -19,6 +19,7 @@
 
 from cubicweb.toolsutils import CommandHandler
 from cubicweb.web.webctl import WebCreateHandler, WebUpgradeHandler
+from cubicweb.server import serverctl
 
 # trigger configuration registration
 import cubicweb.etwist.twconfig # pylint: disable=W0611
@@ -45,35 +46,30 @@
     cfgname = 'twisted'
 
 
-try:
-    from cubicweb.server import serverctl
-    class AllInOneCreateHandler(serverctl.RepositoryCreateHandler,
-                                TWCreateHandler):
-        """configuration to get an instance running in a twisted web server
-        integrating a repository server in the same process
-        """
-        cfgname = 'all-in-one'
+class AllInOneCreateHandler(serverctl.RepositoryCreateHandler,
+                            TWCreateHandler):
+    """configuration to get an instance running in a twisted web server
+    integrating a repository server in the same process
+    """
+    cfgname = 'all-in-one'
 
-        def bootstrap(self, cubes, automatic=False, inputlevel=0):
-            """bootstrap this configuration"""
-            serverctl.RepositoryCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
-            TWCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
+    def bootstrap(self, cubes, automatic=False, inputlevel=0):
+        """bootstrap this configuration"""
+        serverctl.RepositoryCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
+        TWCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
 
-    class AllInOneStartHandler(TWStartHandler):
-        cmdname = 'start'
-        cfgname = 'all-in-one'
-        subcommand = 'cubicweb-twisted'
+class AllInOneStartHandler(TWStartHandler):
+    cmdname = 'start'
+    cfgname = 'all-in-one'
+    subcommand = 'cubicweb-twisted'
 
-    class AllInOneStopHandler(CommandHandler):
-        cmdname = 'stop'
-        cfgname = 'all-in-one'
-        subcommand = 'cubicweb-twisted'
+class AllInOneStopHandler(CommandHandler):
+    cmdname = 'stop'
+    cfgname = 'all-in-one'
+    subcommand = 'cubicweb-twisted'
 
-        def poststop(self):
-            pass
+    def poststop(self):
+        pass
 
-    class AllInOneUpgradeHandler(TWUpgradeHandler):
-        cfgname = 'all-in-one'
-
-except ImportError:
-    pass
+class AllInOneUpgradeHandler(TWUpgradeHandler):
+    cfgname = 'all-in-one'