summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-02 17:44:07 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-02 17:44:07 +0000
commitbc08225dcd719eba0134e8a59ea7932fdea8513d (patch)
tree8f613d5ab51e475da44a87719a1d26f0cee89f7a
parentf2da06c5cf33a766bf6051acfa772f2dbd4237d8 (diff)
downloadfreeipa-bc08225dcd719eba0134e8a59ea7932fdea8513d.tar.gz
freeipa-bc08225dcd719eba0134e8a59ea7932fdea8513d.tar.xz
freeipa-bc08225dcd719eba0134e8a59ea7932fdea8513d.zip
230: Renamed allow_None kwarg to allow_none
-rw-r--r--ipalib/errors.py12
-rw-r--r--ipalib/public.py2
-rw-r--r--ipalib/tests/test_errors.py16
3 files changed, 15 insertions, 15 deletions
diff --git a/ipalib/errors.py b/ipalib/errors.py
index 1b556c33..d68bac40 100644
--- a/ipalib/errors.py
+++ b/ipalib/errors.py
@@ -63,22 +63,22 @@ def raise_TypeError(value, type_, name):
raise e
-def check_type(value, type_, name, allow_None=False):
+def check_type(value, type_, name, allow_none=False):
assert type(name) is str, TYPE_FORMAT % ('name', str, name)
assert type(type_) is type, TYPE_FORMAT % ('type_', type, type_)
- assert type(allow_None) is bool, TYPE_FORMAT % ('allow_None', bool, allow_None)
- if value is None and allow_None:
+ assert type(allow_none) is bool, TYPE_FORMAT % ('allow_none', bool, allow_none)
+ if value is None and allow_none:
return
if type(value) is not type_:
raise_TypeError(value, type_, name)
return value
-def check_isinstance(value, type_, name, allow_None=False):
+def check_isinstance(value, type_, name, allow_none=False):
assert type(type_) is type, TYPE_FORMAT % ('type_', type, type_)
assert type(name) is str, TYPE_FORMAT % ('name', str, name)
- assert type(allow_None) is bool, TYPE_FORMAT % ('allow_None', bool, allow_None)
- if value is None and allow_None:
+ assert type(allow_none) is bool, TYPE_FORMAT % ('allow_none', bool, allow_none)
+ if value is None and allow_none:
return
if not isinstance(value, type_):
raise_TypeError(value, type_, name)
diff --git a/ipalib/public.py b/ipalib/public.py
index 894a56f3..ea9a06a3 100644
--- a/ipalib/public.py
+++ b/ipalib/public.py
@@ -95,7 +95,7 @@ class Option2(plugable.ReadOnly):
self.multivalue = check_type(multivalue, bool, 'multivalue')
self.default = default
self.default_from = check_type(default_from,
- DefaultFrom, 'default_from', allow_None=True)
+ DefaultFrom, 'default_from', allow_none=True)
self.__normalize = normalize
self.rules = (type_.validate,) + rules
lock(self)
diff --git a/ipalib/tests/test_errors.py b/ipalib/tests/test_errors.py
index 6ea0e311..34b195e8 100644
--- a/ipalib/tests/test_errors.py
+++ b/ipalib/tests/test_errors.py
@@ -74,7 +74,7 @@ def test_check_type():
# Should pass:
assert value is f(value, type_, name)
- assert None is f(None, type_, name, allow_None=True)
+ assert None is f(None, type_, name, allow_none=True)
# Should raise TypeError
check_TypeError(f, None, type_, name)
@@ -91,10 +91,10 @@ def test_check_type():
e = raises(AssertionError, f, value, fail_type, name)
assert str(e) == type_format % ('type_', type, fail_type)
- # allow_None not a bool:
+ # allow_none not a bool:
fail_bool = 0
- e = raises(AssertionError, f, value, type_, name, allow_None=fail_bool)
- assert str(e) == type_format % ('allow_None', bool, fail_bool)
+ e = raises(AssertionError, f, value, type_, name, allow_none=fail_bool)
+ assert str(e) == type_format % ('allow_none', bool, fail_bool)
def test_check_isinstance():
@@ -109,7 +109,7 @@ def test_check_isinstance():
# Should pass:
assert value is f(value, type_, name)
assert value is f(value, basestring, name)
- assert None is f(None, type_, name, allow_None=True)
+ assert None is f(None, type_, name, allow_none=True)
# Should raise TypeError
check_TypeError(f, None, type_, name)
@@ -125,7 +125,7 @@ def test_check_isinstance():
e = raises(AssertionError, f, value, fail_type, name)
assert str(e) == type_format % ('type_', type, fail_type)
- # allow_None not a bool:
+ # allow_none not a bool:
fail_bool = 0
- e = raises(AssertionError, f, value, type_, name, allow_None=fail_bool)
- assert str(e) == type_format % ('allow_None', bool, fail_bool)
+ e = raises(AssertionError, f, value, type_, name, allow_none=fail_bool)
+ assert str(e) == type_format % ('allow_none', bool, fail_bool)