Don't set scope in cmdutils.register w/o instance.

This commit is contained in:
Florian Bruhin 2015-04-20 18:55:22 +02:00
parent 8f1b074595
commit 0195cb31bb
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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.