From 0195cb31bb6fe38abad3563c53636967dff75ded Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 20 Apr 2015 18:55:22 +0200 Subject: [PATCH] Don't set scope in cmdutils.register w/o instance. --- qutebrowser/commands/command.py | 3 +++ qutebrowser/misc/utilcmds.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 545c2a36c..6e8f6bce7 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -81,6 +81,9 @@ class Command: for m in not_modes: if not isinstance(m, usertypes.KeyMode): raise TypeError("Mode {} is no KeyMode member!".format(m)) + if scope != 'global' and instance is None: + raise ValueError("Setting scope without setting instance makes " + "no sense!") self.name = name self.maxsplit = maxsplit self.hide = hide diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 816b1ed80..a777623b4 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -34,7 +34,7 @@ from qutebrowser.config import style from qutebrowser.misc import consolewidget -@cmdutils.register(scope='window', maxsplit=1, no_cmd_split=True) +@cmdutils.register(maxsplit=1, no_cmd_split=True) def later(ms: {'type': int}, command, win_id: {'special': 'win_id'}): """Execute a command after some time. @@ -63,7 +63,7 @@ def later(ms: {'type': int}, command, win_id: {'special': 'win_id'}): raise -@cmdutils.register(scope='window', maxsplit=1, no_cmd_split=True) +@cmdutils.register(maxsplit=1, no_cmd_split=True) def repeat(times: {'type': int}, command, win_id: {'special': 'win_id'}): """Repeat a given command.