summaryrefslogtreecommitdiffstats
path: root/ipalib/parameters.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/parameters.py')
-rw-r--r--ipalib/parameters.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index f75057f1e..f592a323f 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -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),
)