ipalib.parameters: Require bytes for Bytes.pattern

Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
Petr Viktorin authored and Tomas Babej committed 2015-10-13 14:16:32 +02:00
1 parent e0eff8b834
commit 614b490402
2 files changed
+4 -2

No files matched your search

+4 -1
View File
@@ -1270,7 +1270,6 @@ class Data(Param):
('minlength', int, None),
('maxlength', int, None),
('length', int, None),
('pattern', (six.string_types,), None),
('pattern_errmsg', (six.string_types,), None),
)
@@ -1338,6 +1337,9 @@ class Bytes(Data):
type = bytes
type_error = _('must be binary data')
kwargs = Data.kwargs + (
('pattern', (bytes,), None),
)
def __init__(self, name, *rules, **kw):
if kw.get('pattern', None) is None:
@@ -1399,6 +1401,7 @@ class Str(Data):
"""
kwargs = Data.kwargs + (
('pattern', (six.string_types,), None),
('noextrawhitespace', bool, True),
)
-1
View File
@@ -692,7 +692,6 @@ class test_Data(ClassChecker):
assert o.minlength is None
assert o.maxlength is None
assert o.length is None
assert o.pattern is None
# Test mixing length with minlength or maxlength:
o = self.cls('my_data', length=5)