Ticket #28906: less_bool.patch

File less_bool.patch, 5.3 KB (added by Дилян Палаузов, 7 years ago)
  • django/contrib/admin/views/main.py

    diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
    a b class ChangeList:  
    194194        self.show_full_result_count = self.model_admin.show_full_result_count
    195195        # Admin actions are shown if there is at least one entry
    196196        # or if entries are not counted because show_full_result_count is disabled
    197         self.show_admin_actions = not self.show_full_result_count or bool(full_result_count)
     197        self.show_admin_actions = not self.show_full_result_count or full_result_count
    198198        self.full_result_count = full_result_count
    199199        self.result_list = result_list
    200200        self.can_show_all = can_show_all
  • django/contrib/sessions/backends/base.py

    diff --git a/django/contrib/sessions/backends/base.py b/django/contrib/sessions/backends/base.py
    a b class SessionBase:  
    141141    def is_empty(self):
    142142        "Return True when there is no session_key and the session is empty."
    143143        try:
    144             return not bool(self._session_key) and not self._session_cache
     144            return not self._session_key and not self._session_cache
    145145        except AttributeError:
    146146            return True
    147147
  • django/core/validators.py

    diff --git a/django/core/validators.py b/django/core/validators.py
    a b class RegexValidator:  
    5454        Validate that the input contains (or does *not* contain, if
    5555        inverse_match is True) a match for the regular expression.
    5656        """
    57         regex_matches = bool(self.regex.search(str(value)))
     57        regex_matches = self.regex.search(str(value))
    5858        invalid_input = regex_matches if self.inverse_match else not regex_matches
    5959        if invalid_input:
    6060            raise ValidationError(self.message, code=self.code)
  • django/db/models/options.py

    diff --git a/django/db/models/options.py b/django/db/models/options.py
    a b class Options:  
    188188                self.verbose_name_plural = format_lazy('{}s', self.verbose_name)
    189189
    190190            # order_with_respect_and ordering are mutually exclusive.
    191             self._ordering_clash = bool(self.ordering and self.order_with_respect_to)
     191            self._ordering_clash = self.ordering and self.order_with_respect_to
    192192
    193193            # Any leftover attributes must be invalid.
    194194            if meta_attrs != {}:
  • django/forms/forms.py

    diff --git a/django/forms/forms.py b/django/forms/forms.py
    a b class BaseForm:  
    139139        if self._errors is None:
    140140            is_valid = "Unknown"
    141141        else:
    142             is_valid = self.is_bound and not bool(self._errors)
     142            is_valid = self.is_bound and not self._errors
    143143        return '<%(cls)s bound=%(bound)s, valid=%(valid)s, fields=(%(fields)s)>' % {
    144144            'cls': self.__class__.__name__,
    145145            'bound': self.is_bound,
  • django/forms/widgets.py

    diff --git a/django/forms/widgets.py b/django/forms/widgets.py
    a b class Select(ChoiceWidget):  
    681681    def _choice_has_empty_value(choice):
    682682        """Return True if the choice's value is empty string or None."""
    683683        value, _ = choice
    684         return (isinstance(value, str) and not bool(value)) or value is None
     684        return (isinstance(value, str) and not value) or value is None
    685685
    686686    def use_required_attribute(self, initial):
    687687        """
  • django/middleware/common.py

    diff --git a/django/middleware/common.py b/django/middleware/common.py
    a b class BrokenLinkEmailsMiddleware(MiddlewareMixin):  
    135135
    136136    def is_internal_request(self, domain, referer):
    137137        """
    138         Return True if the referring URL is the same domain as the current
    139         request.
     138        Only if the referring URL is the same domain as the current request, then
     139        passing the result to bool() will evaluate to True.
    140140        """
    141141        # Different subdomains are treated as different domains.
    142         return bool(re.match("^https?://%s/" % re.escape(domain), referer))
     142        return re.match("^https?://%s/" % re.escape(domain), referer)
    143143
    144144    def is_ignorable_request(self, request, uri, domain, referer):
    145145        """
  • django/template/backends/base.py

    diff --git a/django/template/backends/base.py b/django/template/backends/base.py
    a b class BaseEngine:  
    2020        params = params.copy()
    2121        self.name = params.pop('NAME')
    2222        self.dirs = list(params.pop('DIRS'))
    23         self.app_dirs = bool(params.pop('APP_DIRS'))
     23        self.app_dirs = params.pop('APP_DIRS')
    2424        if params:
    2525            raise ImproperlyConfigured(
    2626                "Unknown parameters: {}".format(", ".join(params)))
  • django/utils/http.py

    diff --git a/django/utils/http.py b/django/utils/http.py
    a b def _urlsplit(url, scheme='', allow_fragments=True):  
    324324    Note that we don't break the components up in smaller bits
    325325    (e.g. netloc is a single string) and we don't expand % escapes."""
    326326    url, scheme, _coerce_result = _coerce_args(url, scheme)
    327     allow_fragments = bool(allow_fragments)
    328327    netloc = query = fragment = ''
    329328    i = url.find(':')
    330329    if i > 0:
Back to Top