summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2009-12-13 22:47:15 +0000
committerAndrew Resch <andrewresch@gmail.com>2009-12-13 22:47:15 +0000
commitf59901c1beb9a767a9b7dcae00235489f8e7b065 (patch)
tree244fe7f2da5847ad1f7382022654447052f1c992
parentee76075fa49e18e305f60dae61d852d6d44a6df4 (diff)
downloaddeluge-f59901c1beb9a767a9b7dcae00235489f8e7b065.tar.gz
deluge-f59901c1beb9a767a9b7dcae00235489f8e7b065.tar.bz2
deluge-f59901c1beb9a767a9b7dcae00235489f8e7b065.zip
Fix #823 setting config values to -1.0
-rw-r--r--ChangeLog1
-rw-r--r--deluge/ui/console/commands/config.py17
2 files changed, 9 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index d36db82fd..d4e46bed4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,7 @@
==== Console ====
* Fix using the console in Windows, but only in command-line mode
+ * Fix #823 setting config values to -1.0
==== Label ====
* Fix #1085 only use ints for specific options to prevent unhandled exception
diff --git a/deluge/ui/console/commands/config.py b/deluge/ui/console/commands/config.py
index 04f8f7e22..2a3ad9fac 100644
--- a/deluge/ui/console/commands/config.py
+++ b/deluge/ui/console/commands/config.py
@@ -102,7 +102,7 @@ class Command(BaseCommand):
"""Show and set configuration values"""
option_list = BaseCommand.option_list + (
- make_option('-s', '--set', action='store_true', default=False, dest='set',
+ make_option('-s', '--set', action='store', nargs=2, dest='set',
help='set value for key'),
)
usage = "Usage: config [key1 [key2 ...]]\n"\
@@ -153,19 +153,18 @@ class Command(BaseCommand):
def _set_config(self, *args, **options):
deferred = defer.Deferred()
config = component.get("CoreConfig")
- key = args[0]
+ key = options["set"][0]
+ val = options["set"][1]
if key not in config.keys():
self.console.write("{!error!}The key '%s' is invalid!" % key)
return
- try:
- val = simple_eval(' '.join(args[1:]))
- except SyntaxError, e:
- self.console.write("{!error!}%s" % e)
- return
if type(config[key]) != type(val):
- self.config.write("{!error!}Configuration value provided has incorrect type.")
- return
+ try:
+ val = type(config[key])(val)
+ except:
+ self.config.write("{!error!}Configuration value provided has incorrect type.")
+ return
def on_set_config(result):
self.console.write("{!success!}Configuration value successfully updated.")