web/webctl.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 24 Jul 2009 14:33:37 +0200
changeset 2476 1294a6bdf3bf
parent 2395 e3093fc12a00
child 2615 1ea41b7c0836
permissions -rw-r--r--
application -> instance where it makes sense

"""cubicweb-ctl commands and command handlers common to twisted/modpython
web configuration

: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
"""
__docformat__ = "restructuredtext en"

from cubicweb import underline_title
from cubicweb.toolsutils import CommandHandler, confirm


class WebCreateHandler(CommandHandler):
    cmdname = 'create'

    def bootstrap(self, cubes, inputlevel=0):
        """bootstrap this configuration"""
        print '\n'+underline_title('Generic web configuration')
        config = self.config
        if config.repo_method == 'pyro':
            print '\n'+underline_title('Repository server configuration')
            config.input_config('pyro-client', inputlevel)
        if confirm('Allow anonymous access ?', False):
            config.global_set_option('anonymous-user', 'anon')
            config.global_set_option('anonymous-password', 'anon')

    def postcreate(self):
        """hooks called once instance's initialization has been completed"""