etwist/twctl.py
changeset 7619 0d0344fd5231
parent 7140 ba51dac1115d
child 9372 e87a808a4c32
equal deleted inserted replaced
7618:5395007c415c 7619:0d0344fd5231
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    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 os.path import join
       
    21 
       
    22 from logilab.common.shellutils import rm
       
    23 
    20 from cubicweb.toolsutils import CommandHandler
    24 from cubicweb.toolsutils import CommandHandler
    21 from cubicweb.web.webctl import WebCreateHandler
    25 from cubicweb.web.webctl import WebCreateHandler
    22 
    26 
    23 # trigger configuration registration
    27 # trigger configuration registration
    24 import cubicweb.etwist.twconfig # pylint: disable=W0611
    28 import cubicweb.etwist.twconfig # pylint: disable=W0611
    30     cmdname = 'start'
    34     cmdname = 'start'
    31     cfgname = 'twisted'
    35     cfgname = 'twisted'
    32 
    36 
    33     def start_server(self, config):
    37     def start_server(self, config):
    34         from cubicweb.etwist import server
    38         from cubicweb.etwist import server
       
    39         config.info('clear ui caches')
       
    40         for cachedir in ('uicache', 'uicachehttps'):
       
    41             rm(join(config.appdatahome, cachedir, '*'))
    35         return server.run(config)
    42         return server.run(config)
    36 
    43 
    37 class TWStopHandler(CommandHandler):
    44 class TWStopHandler(CommandHandler):
    38     cmdname = 'stop'
    45     cmdname = 'stop'
    39     cfgname = 'twisted'
    46     cfgname = 'twisted'