B [schema update] may remove has_text unexpectedly, give another argument to fix it
"""cubicweb-clt handlers for twisted:organization: Logilab:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses"""importsysfromcubicwebimportunderline_titlefromcubicweb.toolsutilsimportCommandHandlerfromcubicweb.web.webctlimportWebCreateHandler# trigger configuration registrationimportcubicweb.etwist.twconfig# pylint: disable-msg=W0611classTWCreateHandler(WebCreateHandler):cfgname='twisted'defbootstrap(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 serverapplication = server.main(%r, %r)'''%(self.config.appid,self.config.name))mainpy.close()print'-> generated %s'%mainpyfilesuper(TWCreateHandler,self).bootstrap(cubes,inputlevel)classTWStartHandler(CommandHandler):cmdname='start'cfgname='twisted'defstart_command(self,config,debug):command=['%s `which twistd`'%sys.executable]forctl_opt,server_optin(('pid-file','pidfile'),('uid','uid'),('log-file','logfile',)):value=config[ctl_opt]ifnotvalueor(debugandctl_opt=='log-file'):continuecommand.append('--%s%s'%(server_opt,value))ifdebug:command.append('-n')ifconfig['profile']:command.append('-p %s --savestats'%config['profile'])command.append('-oy')command.append(self.config.server_file())return' '.join(command)classTWStopHandler(CommandHandler):cmdname='stop'cfgname='twisted'try:fromcubicweb.serverimportserverctlclassAllInOneCreateHandler(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'defbootstrap(self,cubes,inputlevel=0):"""bootstrap this configuration"""serverctl.RepositoryCreateHandler.bootstrap(self,cubes,inputlevel)TWCreateHandler.bootstrap(self,cubes,inputlevel)classAllInOneStartHandler(TWStartHandler):cmdname='start'cfgname='all-in-one'subcommand='cubicweb-twisted'classAllInOneStopHandler(serverctl.RepositoryStopHandler):cmdname='stop'cfgname='all-in-one'subcommand='cubicweb-twisted'exceptImportError:pass