summaryrefslogtreecommitdiffstats
path: root/ipalib/parameters.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-05-04 10:34:00 -0400
committerMartin Kosek <mkosek@redhat.com>2012-05-09 09:43:35 +0200
commitd9d196798945bef7a955acb8b71820800455be17 (patch)
treefcdbbb63b26640f9255a264b62d53248e8e11ba1 /ipalib/parameters.py
parentabef5e8c027bf37d9522f4d30e8e43c408251893 (diff)
downloadfreeipa-d9d196798945bef7a955acb8b71820800455be17.tar.gz
freeipa-d9d196798945bef7a955acb8b71820800455be17.tar.xz
freeipa-d9d196798945bef7a955acb8b71820800455be17.zip
Redo boolean value encoding.
Move the code for encoding boolean values to LDAP boolean syntax from the Parameter class to the Encoder class, where the rest of LDAP encoding takes place. Remove encoding code from the Parameter class altogether, as all LDAP encoding should be done in the Encoder class.
Diffstat (limited to 'ipalib/parameters.py')
-rw-r--r--ipalib/parameters.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 35dbdd957..e9951a1c8 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -306,8 +306,6 @@ class Param(ReadOnly):
- primary_key: Command's parameter primary key is used for unique
identification of an LDAP object and for sorting
- normalizer: a custom function for Param value normalization
- - encoder: a custom function used to override Param subclass default
- encoder
- default_from: a custom function for generating default values of
parameter instance
- autofill: by default, only `required` parameters get a default value
@@ -381,7 +379,6 @@ class Param(ReadOnly):
('multivalue', bool, False),
('primary_key', bool, False),
('normalizer', callable, None),
- ('encoder', callable, None),
('default_from', DefaultFrom, None),
('autofill', bool, False),
('query', bool, False),
@@ -901,36 +898,6 @@ class Param(ReadOnly):
rule=rule,
)
- 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).
-
- The default encode method `Param._encode` can be overriden in a `Param`
- instance with `encoder` attribute:
-
- >>> s = Str('my_str', encoder=lambda x:encode(x))
-
- Note that the default method of encoding values is defined in
- `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 and not force: #pylint: disable=E1101
- return value
- if self.encoder is not None: #pylint: disable=E1101
- return self.encoder(value) #pylint: disable=E1101
-
- return self._encode(value)
-
- def _encode(self, value):
- """
- Encode a value to backend format.
- """
- return value
-
def get_default(self, **kw):
"""
Return the static default or construct and return a dynamic default.