summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/parameters.py6
-rw-r--r--ipalib/plugins/baseldap.py7
2 files changed, 10 insertions, 3 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 60fb5023..5c55d8bc 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -895,7 +895,7 @@ class Param(ReadOnly):
rule=rule,
)
- def encode(self, value):
+ def encode(self, value, force=False):
"""
Encode Python native type value to chosen backend format. Encoding is
applied for parameters representing actual attributes (attribute=True).
@@ -909,8 +909,10 @@ class Param(ReadOnly):
`Param._encode()`.
:param value: Encoded value
+ :param force: If set to true, encoding takes place even for Params
+ not marked as attribute
"""
- if not self.attribute: #pylint: disable=E1101
+ if not self.attribute and not force: #pylint: disable=E1101
return value
if self.encoder is not None: #pylint: disable=E1101
return self.encoder(value) #pylint: disable=E1101
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index daf1b07f..3e792347 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -937,7 +937,12 @@ last, after all sets and adds."""),
raise errors.ValidationError(name=attr, error=err.error)
except errors.ConversionError, err:
raise errors.ConversionError(name=attr, error=err.error)
- value = param.encode(value)
+ # FIXME: We use `force` when encoding because we know this is
+ # an attribute, even if it does not have the `attribute` flag
+ # set. This happens with no_update attributes, which are
+ # not cloned to Update commands. This cloning is where the flag
+ # gets set.
+ value = param.encode(value, force=True)
entry_attrs[attr] = value
else:
# unknown attribute: remove duplicite and invalid values