etwist/twctl.py
branchstable
changeset 3820 52cd7432030d
parent 3180 6bab5746ebf5
child 3821 653ddc1e4179
equal deleted inserted replaced
3819:7591b89ada23 3820:52cd7432030d
     8 
     8 
     9 import sys
     9 import sys
    10 
    10 
    11 from cubicweb import underline_title
    11 from cubicweb import underline_title
    12 from cubicweb.toolsutils import CommandHandler
    12 from cubicweb.toolsutils import CommandHandler
       
    13 from cubicweb.web.webctl import WebCreateHandler
    13 
    14 
    14 # trigger configuration registration
    15 # trigger configuration registration
    15 import cubicweb.etwist.twconfig # pylint: disable-msg=W0611
    16 import cubicweb.etwist.twconfig # pylint: disable-msg=W0611
       
    17 
       
    18 class TWCreateHandler(WebCreateHandler):
       
    19     cfgname = 'twisted'
    16 
    20 
    17 class TWStartHandler(CommandHandler):
    21 class TWStartHandler(CommandHandler):
    18     cmdname = 'start'
    22     cmdname = 'start'
    19     cfgname = 'twisted'
    23     cfgname = 'twisted'
    20 
    24 
    27     cfgname = 'twisted'
    31     cfgname = 'twisted'
    28 
    32 
    29 
    33 
    30 try:
    34 try:
    31     from cubicweb.server import serverctl
    35     from cubicweb.server import serverctl
    32 
    36     from cubicweb.server import serverctl
    33     class AllInOneCreateHandler(serverctl.RepositoryCreateHandler):
    37     WebCreateHandler
       
    38     class AllInOneCreateHandler(serverctl.RepositoryCreateHandler,
       
    39                                 TWCreateHandler):
    34         """configuration to get an instance running in a twisted web server
    40         """configuration to get an instance running in a twisted web server
    35         integrating a repository server in the same process
    41         integrating a repository server in the same process
    36         """
    42         """
    37         cfgname = 'all-in-one'
    43         cfgname = 'all-in-one'
    38 
    44 
    39         def bootstrap(self, cubes, inputlevel=0):
    45         def bootstrap(self, cubes, inputlevel=0):
    40             """bootstrap this configuration"""
    46             """bootstrap this configuration"""
    41             serverctl.RepositoryCreateHandler.bootstrap(self, cubes, inputlevel)
    47             serverctl.RepositoryCreateHandler.bootstrap(self, cubes, inputlevel)
       
    48             TWCreateHandler.bootstrap(self, cubes, inputlevel)
    42 
    49 
    43     class AllInOneStartHandler(TWStartHandler):
    50     class AllInOneStartHandler(TWStartHandler):
    44         cmdname = 'start'
    51         cmdname = 'start'
    45         cfgname = 'all-in-one'
    52         cfgname = 'all-in-one'
    46         subcommand = 'cubicweb-twisted'
    53         subcommand = 'cubicweb-twisted'