mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
229: Option2.__init__() now uses check_type()
This commit is contained in:
parent
8b7fe7139d
commit
f2da06c5cf
@ -25,8 +25,9 @@ and UI all use.
|
|||||||
import re
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
import plugable
|
import plugable
|
||||||
from plugable import lock
|
from plugable import lock, check_name
|
||||||
import errors
|
import errors
|
||||||
|
from errors import check_type, check_isinstance
|
||||||
import ipa_types
|
import ipa_types
|
||||||
|
|
||||||
|
|
||||||
@ -87,13 +88,14 @@ class DefaultFrom(plugable.ReadOnly):
|
|||||||
class Option2(plugable.ReadOnly):
|
class Option2(plugable.ReadOnly):
|
||||||
def __init__(self, name, doc, type_, required=False, multivalue=False,
|
def __init__(self, name, doc, type_, required=False, multivalue=False,
|
||||||
default=None, default_from=None, rules=tuple(), normalize=None):
|
default=None, default_from=None, rules=tuple(), normalize=None):
|
||||||
self.name = name
|
self.name = check_name(name)
|
||||||
self.doc = doc
|
self.doc = check_type(doc, str, 'doc')
|
||||||
self.type = type_
|
self.type = check_isinstance(type_, ipa_types.Type, 'type_')
|
||||||
self.required = required
|
self.required = check_type(required, bool, 'required')
|
||||||
self.multivalue = multivalue
|
self.multivalue = check_type(multivalue, bool, 'multivalue')
|
||||||
self.default = default
|
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.__normalize = normalize
|
||||||
self.rules = (type_.validate,) + rules
|
self.rules = (type_.validate,) + rules
|
||||||
lock(self)
|
lock(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user