diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-02 17:41:55 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-02 17:41:55 +0000 |
commit | f2da06c5cf33a766bf6051acfa772f2dbd4237d8 (patch) | |
tree | 2db7a552dad2b6726feb73f82838430508f5963e /ipalib/public.py | |
parent | 8b7fe7139dc47a421dd34376374a0ed06dc73f39 (diff) | |
download | freeipa.git-f2da06c5cf33a766bf6051acfa772f2dbd4237d8.tar.gz freeipa.git-f2da06c5cf33a766bf6051acfa772f2dbd4237d8.tar.xz freeipa.git-f2da06c5cf33a766bf6051acfa772f2dbd4237d8.zip |
229: Option2.__init__() now uses check_type()
Diffstat (limited to 'ipalib/public.py')
-rw-r--r-- | ipalib/public.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ipalib/public.py b/ipalib/public.py index 147596e1..894a56f3 100644 --- a/ipalib/public.py +++ b/ipalib/public.py @@ -25,8 +25,9 @@ and UI all use. import re import inspect import plugable -from plugable import lock +from plugable import lock, check_name import errors +from errors import check_type, check_isinstance import ipa_types @@ -87,13 +88,14 @@ class DefaultFrom(plugable.ReadOnly): class Option2(plugable.ReadOnly): def __init__(self, name, doc, type_, required=False, multivalue=False, default=None, default_from=None, rules=tuple(), normalize=None): - self.name = name - self.doc = doc - self.type = type_ - self.required = required - self.multivalue = multivalue + self.name = check_name(name) + self.doc = check_type(doc, str, 'doc') + self.type = check_isinstance(type_, ipa_types.Type, 'type_') + self.required = check_type(required, bool, 'required') + self.multivalue = check_type(multivalue, bool, 'multivalue') self.default = default - self.default_from = default_from + self.default_from = check_type(default_from, + DefaultFrom, 'default_from', allow_None=True) self.__normalize = normalize self.rules = (type_.validate,) + rules lock(self) |