diff options
author | Nathaniel McCallum <npmccallum@redhat.com> | 2013-09-30 13:06:37 -0400 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-10-08 16:14:32 +0200 |
commit | fd63505f6d02e5ef4630df49054d3b11fffcf54f (patch) | |
tree | 0df119acbfb706dffa61743dce47b913094f7a78 /ipalib/parameters.py | |
parent | 091e8fac3473e794e339b4a1a1ae819de8736af9 (diff) | |
download | freeipa-fd63505f6d02e5ef4630df49054d3b11fffcf54f.tar.gz freeipa-fd63505f6d02e5ef4630df49054d3b11fffcf54f.tar.xz freeipa-fd63505f6d02e5ef4630df49054d3b11fffcf54f.zip |
Don't special case the Password class in Param.__init__()
Diffstat (limited to 'ipalib/parameters.py')
-rw-r--r-- | ipalib/parameters.py | 17 |
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), ) |