Updated documentation.

Updated documentation explaining use. Also mentioned the result of chaining get_inputs.
This commit is contained in:
CloudKeeper1 2017-04-23 21:40:37 +10:00 committed by Griatch
parent 4327bc48d3
commit 9c37665f00

View file

@ -957,6 +957,13 @@ def get_input(caller, prompt, callback, session=None, *args, **kwargs):
greater than 2. The session is then updated by the greater than 2. The session is then updated by the
command and is available (for example in callbacks) command and is available (for example in callbacks)
through `caller.ndb.getinput._session`. through `caller.ndb.getinput._session`.
*args, **kwargs (optional): Extra arguments will be
passed to the fall back function as a list 'args'
and all keyword arguments as a dictionary 'kwargs'.
To utilise *args and **kwargs, a value for the
session argument must be provided (None by default)
and the callback function must take *args and
**kwargs as arguments.
Raises: Raises:
RuntimeError: If the given callback is not callable. RuntimeError: If the given callback is not callable.
@ -976,6 +983,12 @@ def get_input(caller, prompt, callback, session=None, *args, **kwargs):
multisession modes), then it is available in the multisession modes), then it is available in the
callback through `caller.ndb._getinput._session`. callback through `caller.ndb._getinput._session`.
Chaining get_input functions will result in the caller
stacking ever more instances of InputCmdSets. Whilst
they will all be cleared on concluding the get_input
chain, EvMenu should be considered for anything beyond
a single question.
""" """
if not callable(callback): if not callable(callback):
raise RuntimeError("get_input: input callback is not callable.") raise RuntimeError("get_input: input callback is not callable.")