summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-17 19:34:26 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-17 19:34:26 -0600
commit8322138f38a4f9c826e4ab148a4fee7df5e93b34 (patch)
tree82d3e81b8b5b27b5f7ad6619c5fe0e2c538c072f
parentf7b7fa5553fa216caea67ba8a952ce71f29863db (diff)
downloadfreeipa-8322138f38a4f9c826e4ab148a4fee7df5e93b34.tar.gz
freeipa-8322138f38a4f9c826e4ab148a4fee7df5e93b34.tar.xz
freeipa-8322138f38a4f9c826e4ab148a4fee7df5e93b34.zip
Added new Param.flags attribute (set with flags=foo kwarg)
-rw-r--r--ipalib/frontend.py3
-rw-r--r--tests/test_ipalib/test_frontend.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index da4fd00b1..bf3eb7f28 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -207,6 +207,7 @@ class Param(plugable.ReadOnly):
normalize callable None
default same as type.type None
default_from callable None
+ flags frozenset frozenset()
============ ================= ==================
"""
__nones = (None, '', tuple(), [])
@@ -220,6 +221,7 @@ class Param(plugable.ReadOnly):
normalize=None,
default=None,
default_from=None,
+ flags=frozenset(),
rules=tuple(),
)
@@ -249,6 +251,7 @@ class Param(plugable.ReadOnly):
self.default_from = check_type(df, DefaultFrom, 'default_from',
allow_none=True
)
+ self.flags = frozenset(kw['flags'])
self.__normalize = kw['normalize']
self.rules = self.__check_type(tuple, 'rules')
self.all_rules = (self.type.validate,) + self.rules
diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py
index c57428867..7760ffbe3 100644
--- a/tests/test_ipalib/test_frontend.py
+++ b/tests/test_ipalib/test_frontend.py
@@ -162,6 +162,7 @@ class test_Param(ClassChecker):
assert read_only(o, 'multivalue') is False
assert read_only(o, 'default') is None
assert read_only(o, 'default_from') is None
+ assert read_only(o, 'flags') == frozenset()
assert read_only(o, 'rules') == tuple()
assert len(read_only(o, 'all_rules')) == 1
assert read_only(o, 'primary_key') is False
@@ -183,6 +184,8 @@ class test_Param(ClassChecker):
assert type(o.default_from) is frontend.DefaultFrom
assert o.default_from.keys == ('first', 'last')
assert o.default_from.callback('butt', 'erfly') == 'butterfly'
+ assert self.cls(name, flags=('one', 'two', 'three')).flags == \
+ frozenset(['one', 'two', 'three'])
rules = (lambda whatever: 'Not okay!',)
o = self.cls(name, rules=rules)
assert o.rules is rules