# HG changeset patch # User Nicolas Chauvat # Date 1251193516 -7200 # Node ID 46a5a94287fa7a8ca32468964e73bd21fe579ce5 # Parent 23418c13e024bcc57b2108eec34d0ffd858751cc# Parent bc0a270622c2fe7b23755146f36f1d7ed7253f7b backport stable branch diff -r 23418c13e024 -r 46a5a94287fa server/serverctl.py --- a/server/serverctl.py Tue Aug 25 11:18:41 2009 +0200 +++ b/server/serverctl.py Tue Aug 25 11:45:16 2009 +0200 @@ -257,12 +257,19 @@ 'help': 'verbose mode: will ask all possible configuration questions', } ), + ('automatic', + {'short': 'a', 'type' : 'yn', 'metavar': '', + 'default': 'n', + 'help': 'automatic mode: never ask and use default answer to every question', + } + ), ) def run(self, args): """run the command with its specific arguments""" from logilab.common.adbh import get_adv_func_helper from indexer import get_indexer verbose = self.get('verbose') + automatic = self.get('automatic') appid = pop_arg(args, msg='No instance specified !') config = ServerConfiguration.config_for(appid) create_db = self.config.create_db @@ -277,13 +284,13 @@ try: if helper.users_support: user = source['db-user'] - if not helper.user_exists(cursor, user) and \ - ASK.confirm('Create db user %s ?' % user, default_is_yes=False): + if not helper.user_exists(cursor, user) and (automatic or \ + ASK.confirm('Create db user %s ?' % user, default_is_yes=False)): helper.create_user(source['db-user'], source['db-password']) print '-> user %s created.' % user dbname = source['db-name'] if dbname in helper.list_databases(cursor): - if ASK.confirm('Database %s already exists -- do you want to drop it ?' % dbname): + if automatic or ASK.confirm('Database %s already exists -- do you want to drop it ?' % dbname): cursor.execute('DROP DATABASE %s' % dbname) else: return @@ -311,7 +318,7 @@ cnx.commit() print '-> database for instance %s created and necessary extensions installed.' % appid print - if ASK.confirm('Run db-init to initialize the system database ?'): + if automatic or ASK.confirm('Run db-init to initialize the system database ?'): cmd_run('db-init', config.appid) else: print ('-> nevermind, you can do it later with ' diff -r 23418c13e024 -r 46a5a94287fa web/views/cwuser.py --- a/web/views/cwuser.py Tue Aug 25 11:18:41 2009 +0200 +++ b/web/views/cwuser.py Tue Aug 25 11:45:16 2009 +0200 @@ -11,9 +11,10 @@ from cubicweb.selectors import one_line_rset, implements, match_user_groups from cubicweb.view import EntityView -from cubicweb.web import action +from cubicweb.web import action, uicfg from cubicweb.web.views import primary +uicfg.primaryview_section.tag_attribute(('CWUser', 'login'), 'hidden') class UserPreferencesEntityAction(action.Action): id = 'prefs'