mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #25875 -- Prevented UnicodeDecodeError for Q object repr
Thanks Ben Kraft for the report, and Simon Charette for the review.
This commit is contained in:
@@ -5,6 +5,8 @@ ORM.
|
||||
|
||||
import copy
|
||||
|
||||
from django.utils.encoding import force_str, force_text
|
||||
|
||||
|
||||
class Node(object):
|
||||
"""
|
||||
@@ -42,14 +44,11 @@ class Node(object):
|
||||
return obj
|
||||
|
||||
def __str__(self):
|
||||
if self.negated:
|
||||
return '(NOT (%s: %s))' % (self.connector, ', '.join(str(c) for c
|
||||
in self.children))
|
||||
return '(%s: %s)' % (self.connector, ', '.join(str(c) for c in
|
||||
self.children))
|
||||
template = '(NOT (%s: %s))' if self.negated else '(%s: %s)'
|
||||
return force_str(template % (self.connector, ', '.join(force_text(c) for c in self.children)))
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s: %s>" % (self.__class__.__name__, self)
|
||||
return str("<%s: %s>") % (self.__class__.__name__, self)
|
||||
|
||||
def __deepcopy__(self, memodict):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user