From 8c32fb86e2cbeaa3b3800914d9dad5e8bef7bac5 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 18 Feb 2015 23:06:35 +0100 Subject: [PATCH] Make it possible to set options with ! in it. This is needed for a quit! alias for example. The option was wrongly treated as an inversion even though a value was given. --- qutebrowser/config/config.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 8f5ac672b..fac5cd386 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -594,7 +594,7 @@ class ConfigManager(QObject): print_val = True else: try: - if optname.endswith('!'): + if optname.endswith('!') and value is None: val = self.get(sectname, optname[:-1]) layer = 'temp' if temp else 'conf' if isinstance(val, bool): @@ -602,12 +602,12 @@ class ConfigManager(QObject): else: raise cmdexc.CommandError( "set: Attempted inversion of non-boolean value.") - else: - if value is None: - raise cmdexc.CommandError( - "set: The following arguments are required: value") + elif value is not None: layer = 'temp' if temp else 'conf' self.set(layer, sectname, optname, value) + else: + raise cmdexc.CommandError("set: The following arguments " + "are required: value") except (configexc.Error, configparser.Error) as e: raise cmdexc.CommandError("set: {} - {}".format( e.__class__.__name__, e))