From 03669acb70f7f236f6ca6df91005f47eb76d20f6 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Wed, 24 Jul 2013 00:01:28 +0000 Subject: [PATCH] CLI --config values should be enterable in gramps.ini form (e.g. 0 or 1) svn: r22728 --- gramps/cli/argparser.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gramps/cli/argparser.py b/gramps/cli/argparser.py index 49f7dee86..00078097e 100644 --- a/gramps/cli/argparser.py +++ b/gramps/cli/argparser.py @@ -8,7 +8,7 @@ # Copyright (C) 2008 Raphael Ackermann # Copyright (C) 2008 Brian G. Matherly # Copyright (C) 2012 Doug Blank -# Copyright (C) 2012 Paul Franklin +# Copyright (C) 2012-2013 Paul Franklin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ import logging #------------------------------------------------------------------------- from gramps.gen.const import LONGOPTS, SHORTOPTS from gramps.gen.config import config -from gramps.gen.utils.configmanager import safe_eval +from gramps.gen.utils.cast import get_type_converter from gramps.gen.utils.file import get_unicode_path_from_env_var from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext @@ -320,11 +320,14 @@ class ArgParser(object): % (setting_name, repr(setting_value)), file=sys.stderr) if set_value: - if new_value == "DEFAULT": + # does a user want the default config value? + if new_value in ("DEFAULT", _("DEFAULT")): new_value = config.get_default(setting_name) else: - new_value = safe_eval(new_value) + converter = get_type_converter(setting_value) + new_value = converter(new_value) config.set(setting_name, new_value) + # translators: indent "New" to match "Current" print(_(" New Gramps config setting: %s:%s") % (setting_name, repr(config.get(setting_name))),