web/webctl.py
author Alexandre Fayolle <alexandre.fayolle@logilab.fr>
Tue, 27 Apr 2010 11:23:20 +0200
branchstable
changeset 5415 6bb0c3a53589
parent 4252 6c4f109c2b03
child 5421 8167de96c523
permissions -rw-r--r--
ask pyro group config questions for all-in-one config site when pyro is enabled in serverctl.py, the pyro questions are not asked for all-in-one configs, because this is webctl.py's responsibility. However for a all-in-one instance, repo_method is "in-memory" so the pyro questions would not be asked even if pyro had been explicitely enabled before.

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

:organization: Logilab
:copyright: 2001-2010 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.toolsutils import CommandHandler, underline_title
from logilab.common.shellutils import ASK

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' or config.pyro_enabled():
            print '\n' + underline_title('Pyro configuration')
            config.input_config('pyro', inputlevel)
        if ASK.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"""