diff -r 51bf32bbe78d -r 6512522860aa etwist/twctl.py --- a/etwist/twctl.py Sun Aug 02 20:59:57 2009 +0200 +++ b/etwist/twctl.py Mon Aug 03 09:24:50 2009 +0200 @@ -10,50 +10,17 @@ from cubicweb import underline_title from cubicweb.toolsutils import CommandHandler -from cubicweb.web.webctl import WebCreateHandler # trigger configuration registration import cubicweb.etwist.twconfig # pylint: disable-msg=W0611 - -class TWCreateHandler(WebCreateHandler): - cfgname = 'twisted' - - def bootstrap(self, cubes, inputlevel=0): - """bootstrap this configuration""" - print '\n'+underline_title('Configuring Twisted') - mainpyfile = self.config.server_file() - mainpy = open(mainpyfile, 'w') - mainpy.write(''' -from cubicweb.etwist import server -application = server.main(%r, %r) -''' % (self.config.appid, self.config.name)) - mainpy.close() - print '-> generated %s' % mainpyfile - super(TWCreateHandler, self).bootstrap(cubes, inputlevel) - - class TWStartHandler(CommandHandler): cmdname = 'start' cfgname = 'twisted' def start_command(self, config, debug): - command = ['%s `which twistd`' % sys.executable] - for ctl_opt, server_opt in (('pid-file', 'pidfile'), - ('uid', 'uid'), - ('log-file', 'logfile',)): - value = config[ctl_opt] - if not value or (debug and ctl_opt == 'log-file'): - continue - command.append('--%s %s' % (server_opt, value)) - if debug: - command.append('-n') - if config['profile']: - command.append('-p %s --savestats' % config['profile']) - command.append('-oy') - command.append(self.config.server_file()) - return ' '.join(command) - + from cubicweb.etwist import server + server.run(config, debug) class TWStopHandler(CommandHandler): cmdname = 'stop' @@ -63,7 +30,7 @@ try: from cubicweb.server import serverctl - class AllInOneCreateHandler(serverctl.RepositoryCreateHandler, TWCreateHandler): + class AllInOneCreateHandler(serverctl.RepositoryCreateHandler): """configuration to get an instance running in a twisted web server integrating a repository server in the same process """ @@ -72,7 +39,6 @@ def bootstrap(self, cubes, inputlevel=0): """bootstrap this configuration""" serverctl.RepositoryCreateHandler.bootstrap(self, cubes, inputlevel) - TWCreateHandler.bootstrap(self, cubes, inputlevel) class AllInOneStartHandler(TWStartHandler): cmdname = 'start'