magmax/python-inquirer

Class Text doesn't execute functions

mareckii opened this issue · 5 comments

field default doesn't execute function like message,
instead of execute shows string representation of function:
'<function getDefaultLogin at 0x10c9bee60>'

Same issue, looks like it's by design?

class Text(Question):
kind = 'text'
def __init__(self, name, message='', default=None, **kwargs):
super(Text, self).__init__(name, message=message,
default=str(default) if default
else default, **kwargs)

Documentation says function is supported:

default
~~~~~~~
Stores the default value to be used as answer. This allow the user just to press `Enter` to use it. It is optional, using ``None`` if there is no input and no default value.
As in ``message` , you can use a new format string or a function with the sign:
.. code:: python
def get_default(answers): return str()
Where ``answers`` is a ``dict`` containing all previous answers.

The issue was introduced by #62

Created a pull request for this #88

Sorry. This is the wrong link.