cubicweb/etwist/twctl.py
changeset 11989 309cf6a2c24f
parent 11057 0b59724cb3f2
equal deleted inserted replaced
11988:ffde65347797 11989:309cf6a2c24f
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """cubicweb-clt handlers for twisted"""
    18 """cubicweb-clt handlers for twisted"""
    19 
    19 
    20 from cubicweb.toolsutils import CommandHandler
    20 from cubicweb.toolsutils import CommandHandler
    21 from cubicweb.web.webctl import WebCreateHandler, WebUpgradeHandler
    21 from cubicweb.web.webctl import WebCreateHandler, WebUpgradeHandler
       
    22 from cubicweb.server import serverctl
    22 
    23 
    23 # trigger configuration registration
    24 # trigger configuration registration
    24 import cubicweb.etwist.twconfig # pylint: disable=W0611
    25 import cubicweb.etwist.twconfig # pylint: disable=W0611
    25 
    26 
    26 class TWCreateHandler(WebCreateHandler):
    27 class TWCreateHandler(WebCreateHandler):
    43 
    44 
    44 class TWUpgradeHandler(WebUpgradeHandler):
    45 class TWUpgradeHandler(WebUpgradeHandler):
    45     cfgname = 'twisted'
    46     cfgname = 'twisted'
    46 
    47 
    47 
    48 
    48 try:
    49 class AllInOneCreateHandler(serverctl.RepositoryCreateHandler,
    49     from cubicweb.server import serverctl
    50                             TWCreateHandler):
    50     class AllInOneCreateHandler(serverctl.RepositoryCreateHandler,
    51     """configuration to get an instance running in a twisted web server
    51                                 TWCreateHandler):
    52     integrating a repository server in the same process
    52         """configuration to get an instance running in a twisted web server
    53     """
    53         integrating a repository server in the same process
    54     cfgname = 'all-in-one'
    54         """
       
    55         cfgname = 'all-in-one'
       
    56 
    55 
    57         def bootstrap(self, cubes, automatic=False, inputlevel=0):
    56     def bootstrap(self, cubes, automatic=False, inputlevel=0):
    58             """bootstrap this configuration"""
    57         """bootstrap this configuration"""
    59             serverctl.RepositoryCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
    58         serverctl.RepositoryCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
    60             TWCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
    59         TWCreateHandler.bootstrap(self, cubes, automatic, inputlevel)
    61 
    60 
    62     class AllInOneStartHandler(TWStartHandler):
    61 class AllInOneStartHandler(TWStartHandler):
    63         cmdname = 'start'
    62     cmdname = 'start'
    64         cfgname = 'all-in-one'
    63     cfgname = 'all-in-one'
    65         subcommand = 'cubicweb-twisted'
    64     subcommand = 'cubicweb-twisted'
    66 
    65 
    67     class AllInOneStopHandler(CommandHandler):
    66 class AllInOneStopHandler(CommandHandler):
    68         cmdname = 'stop'
    67     cmdname = 'stop'
    69         cfgname = 'all-in-one'
    68     cfgname = 'all-in-one'
    70         subcommand = 'cubicweb-twisted'
    69     subcommand = 'cubicweb-twisted'
    71 
    70 
    72         def poststop(self):
    71     def poststop(self):
    73             pass
    72         pass
    74 
    73 
    75     class AllInOneUpgradeHandler(TWUpgradeHandler):
    74 class AllInOneUpgradeHandler(TWUpgradeHandler):
    76         cfgname = 'all-in-one'
    75     cfgname = 'all-in-one'
    77 
       
    78 except ImportError:
       
    79     pass