mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 23:50:03 -06:00
ipalib.parameters: Require bytes for Bytes.pattern
Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
parent
e0eff8b834
commit
614b490402
@ -1270,7 +1270,6 @@ class Data(Param):
|
|||||||
('minlength', int, None),
|
('minlength', int, None),
|
||||||
('maxlength', int, None),
|
('maxlength', int, None),
|
||||||
('length', int, None),
|
('length', int, None),
|
||||||
('pattern', (six.string_types,), None),
|
|
||||||
('pattern_errmsg', (six.string_types,), None),
|
('pattern_errmsg', (six.string_types,), None),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1338,6 +1337,9 @@ class Bytes(Data):
|
|||||||
|
|
||||||
type = bytes
|
type = bytes
|
||||||
type_error = _('must be binary data')
|
type_error = _('must be binary data')
|
||||||
|
kwargs = Data.kwargs + (
|
||||||
|
('pattern', (bytes,), None),
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, name, *rules, **kw):
|
def __init__(self, name, *rules, **kw):
|
||||||
if kw.get('pattern', None) is None:
|
if kw.get('pattern', None) is None:
|
||||||
@ -1399,6 +1401,7 @@ class Str(Data):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
kwargs = Data.kwargs + (
|
kwargs = Data.kwargs + (
|
||||||
|
('pattern', (six.string_types,), None),
|
||||||
('noextrawhitespace', bool, True),
|
('noextrawhitespace', bool, True),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -692,7 +692,6 @@ class test_Data(ClassChecker):
|
|||||||
assert o.minlength is None
|
assert o.minlength is None
|
||||||
assert o.maxlength is None
|
assert o.maxlength is None
|
||||||
assert o.length is None
|
assert o.length is None
|
||||||
assert o.pattern is None
|
|
||||||
|
|
||||||
# Test mixing length with minlength or maxlength:
|
# Test mixing length with minlength or maxlength:
|
||||||
o = self.cls('my_data', length=5)
|
o = self.cls('my_data', length=5)
|
||||||
|
Loading…
Reference in New Issue
Block a user