From adfbfef8c17bd8d8b4feba31770c0d35cca597f4 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 29 Mar 2011 21:01:47 +0000 Subject: [PATCH] minor refactoring --- lib/core/option.py | 27 ++++++--------------------- lib/parse/cmdline.py | 3 +++ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 53187180d..94d48bf6d 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1139,6 +1139,9 @@ def __cleanupOptions(): if conf.data: conf.data = urldecode(conf.data) + if conf.template: + map(lambda x: conf.__setitem__(x, True), ['tor', 'flushSession', 'batch', 'getBanner', 'getCurrentUser', 'getCurrentDb', 'getDbs', 'randomAgent']) + def __setConfAttributes(): """ This function set some needed attributes into the configuration @@ -1297,29 +1300,11 @@ def __useWizardInterface(): message = "[4] Enumeration ('--banner'/'--current-user'/...) [Please choose: 1-Basic(default), 2-Smart, 3-All]: " choice = readInput(message, default='1') if choice == '2': - conf.getBanner = True - conf.getCurrentUser = True - conf.getCurrentDb = True - conf.isDba = True - conf.getUsers = True - conf.getDbs = True - conf.getTables = True - conf.excludeSysDbs = True + map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getDbs', 'getTables', 'excludeSysDbs']) elif choice == '3': - conf.getBanner = True - conf.getCurrentUser = True - conf.getCurrentDb = True - conf.isDba = True - conf.getUsers = True - conf.getPasswordHashes = True - conf.getPrivileges = True - conf.getRoles = True - conf.dumpAll = True + map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getPasswordHashes', 'getPrivileges', 'getRoles', 'dumpAll']) else: - conf.getBanner = True - conf.getCurrentUser = True - conf.getCurrentDb = True - conf.isDba = True + map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba']) conf.batch = True print diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 9cd1c68fb..a14a6f2d1 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -534,6 +534,9 @@ def cmdLineParser(): parser.add_option("--group-concat", dest="groupConcat", action="store_true", default=False, help=SUPPRESS_HELP) + parser.add_option("--template", dest="template", action="store_true", + default=False, help=SUPPRESS_HELP) + parser.add_option_group(target) parser.add_option_group(request) parser.add_option_group(optimization)