mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Don't special case the Password class in Param.__init__()
This commit is contained in:
parent
091e8fac34
commit
fd63505f6d
@ -370,6 +370,8 @@ class Param(ReadOnly):
|
||||
# _convert_scalar operates only on scalar values
|
||||
scalar_error = _('Only one value is allowed')
|
||||
|
||||
password = False
|
||||
|
||||
kwargs = (
|
||||
('cli_name', str, None),
|
||||
('cli_short_name', str, None),
|
||||
@ -401,11 +403,6 @@ class Param(ReadOnly):
|
||||
self.param_spec = name
|
||||
self.__kw = dict(kw)
|
||||
|
||||
if isinstance(self, Password):
|
||||
self.password = True
|
||||
else:
|
||||
self.password = False
|
||||
|
||||
# Merge in kw from parse_param_spec():
|
||||
(name, kw_from_spec) = parse_param_spec(name)
|
||||
if not 'required' in kw:
|
||||
@ -635,9 +632,8 @@ class Param(ReadOnly):
|
||||
"""
|
||||
Return a value safe for logging.
|
||||
|
||||
This is used so that passwords don't get logged. If this is a
|
||||
`Password` instance and ``value`` is not ``None``, a constant
|
||||
``u'********'`` is returned. For example:
|
||||
This is used so that sensitive values like passwords don't get logged.
|
||||
For example:
|
||||
|
||||
>>> p = Password('my_password')
|
||||
>>> p.safe_value(u'This is my password')
|
||||
@ -645,9 +641,6 @@ class Param(ReadOnly):
|
||||
>>> p.safe_value(None) is None
|
||||
True
|
||||
|
||||
If this is not a `Password` instance, ``value`` is returned unchanged.
|
||||
For example:
|
||||
|
||||
>>> s = Str('my_str')
|
||||
>>> s.safe_value(u'Some arbitrary value')
|
||||
u'Some arbitrary value'
|
||||
@ -1500,6 +1493,8 @@ class Password(Str):
|
||||
A parameter for passwords (stored in the ``unicode`` type).
|
||||
"""
|
||||
|
||||
password = True
|
||||
|
||||
kwargs = Str.kwargs + (
|
||||
('confirm', bool, True),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user