1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #28906 -- Removed unnecessary bool() calls.

This commit is contained in:
Tim Graham
2017-12-07 17:13:07 -05:00
committed by GitHub
parent 02d9419fe3
commit 2b81faab25
7 changed files with 7 additions and 10 deletions

View File

@@ -139,7 +139,7 @@ class BaseForm:
if self._errors is None:
is_valid = "Unknown"
else:
is_valid = self.is_bound and not bool(self._errors)
is_valid = self.is_bound and not self._errors
return '<%(cls)s bound=%(bound)s, valid=%(valid)s, fields=(%(fields)s)>' % {
'cls': self.__class__.__name__,
'bound': self.is_bound,

View File

@@ -681,7 +681,7 @@ class Select(ChoiceWidget):
def _choice_has_empty_value(choice):
"""Return True if the choice's value is empty string or None."""
value, _ = choice
return (isinstance(value, str) and not bool(value)) or value is None
return (isinstance(value, str) and not value) or value is None
def use_required_attribute(self, initial):
"""