mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
Stable _is_null check
Avoid comparison of bytes with int in _is_null() check. b'' == 0 triggers a BytesWarning. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
3d9bec2e87
commit
e6129a76e7
@ -123,7 +123,13 @@ from ipapython.dnsutil import DNSName
|
||||
|
||||
|
||||
def _is_null(value):
|
||||
return not value and value != 0 # NOTE: False == 0
|
||||
if value:
|
||||
return False
|
||||
elif isinstance(value, six.integer_types + (float, decimal.Decimal)):
|
||||
# 0 is not NULL
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
Loading…
Reference in New Issue
Block a user