add PasswordOption
This commit is contained in:
parent
d1c9250e34
commit
0c8398e4a6
|
@ -6,7 +6,7 @@ from .option import (ChoiceOption, BoolOption, IntOption, FloatOption,
|
|||
StrOption, UnicodeOption, IPOption, PortOption,
|
||||
NetworkOption, NetmaskOption, BroadcastOption,
|
||||
DomainnameOption, EmailOption, URLOption, UsernameOption,
|
||||
FilenameOption)
|
||||
FilenameOption, PasswordOption)
|
||||
|
||||
|
||||
__all__ = ('MasterSlaves', 'OptionDescription', 'DynOptionDescription',
|
||||
|
@ -15,4 +15,4 @@ __all__ = ('MasterSlaves', 'OptionDescription', 'DynOptionDescription',
|
|||
'IntOption', 'FloatOption', 'StrOption', 'UnicodeOption',
|
||||
'IPOption', 'PortOption', 'NetworkOption', 'NetmaskOption',
|
||||
'BroadcastOption', 'DomainnameOption', 'EmailOption', 'URLOption',
|
||||
'UsernameOption', 'FilenameOption', 'submulti')
|
||||
'UsernameOption', 'FilenameOption', 'PasswordOption', 'submulti')
|
||||
|
|
|
@ -162,6 +162,17 @@ else:
|
|||
return ValueError(_('invalid unicode')) # pragma: optional cover
|
||||
|
||||
|
||||
class PasswordOption(Option):
|
||||
"represents the choice of a password"
|
||||
__slots__ = tuple()
|
||||
|
||||
def _validate(self, value, context=undefined, current_opt=undefined,
|
||||
returns_raise=False):
|
||||
err = self._impl_valid_unicode(value)
|
||||
if err:
|
||||
return err
|
||||
|
||||
|
||||
class IPOption(Option):
|
||||
"represents the choice of an ip"
|
||||
__slots__ = tuple()
|
||||
|
|
Loading…
Reference in New Issue