core & Factoids: Allow commands to disable doc-availability checks for programmatically setting it.

This commit is contained in:
Valentin Lorentz 2013-06-01 17:13:55 +02:00
parent f82a7c7e17
commit 43563bcc1c
2 changed files with 3 additions and 3 deletions

View File

@ -310,7 +310,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
else:
irc.error("This key-factoid relationship already exists.")
learn = wrap(learn, ['factoid'])
learn = wrap(learn, ['factoid'], checkDoc=False)
learn._fake__doc__ = _("""[<channel>] <key> %s <value>
Associates <key> with <value>. <channel> is only

View File

@ -1038,9 +1038,9 @@ class Spec(object):
raise callbacks.ArgumentError
return state
def _wrap(f, specList=[], name=None, **kw):
def _wrap(f, specList=[], name=None, checkDoc=True, **kw):
name = name or f.func_name
assert hasattr(f, '__doc__') and f.__doc__, \
assert (not checkDoc) or (hasattr(f, '__doc__') and f.__doc__), \
'Command %r has no docstring.' % name
f = internationalizeDocstring(f)
spec = Spec(specList, **kw)