command: Check for handlers with count and no default.

This commit is contained in:
Florian Bruhin 2014-10-08 07:40:39 +02:00
parent e2763da8d6
commit 1a00d6168c

View File

@ -174,6 +174,10 @@ class Command:
name_conv = {}
signature = inspect.signature(self.handler)
has_count = 'count' in signature.parameters
if has_count and (signature.parameters['count'].default is
inspect.Parameter.empty):
raise TypeError("{}: handler has count parameter without "
"default!".format(self.name))
doc = inspect.getdoc(self.handler)
if doc is not None:
desc = doc.splitlines()[0].strip()