mirror of
https://github.com/django/django.git
synced 2025-06-09 05:29:13 +00:00
fix: auth tests - quote all strings in repr implementation
This commit is contained in:
parent
3248acee53
commit
0f59f75254
@ -7,7 +7,6 @@ from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation, getcontex
|
||||
from functools import wraps
|
||||
from inspect import unwrap
|
||||
from operator import itemgetter
|
||||
from pprint import pformat
|
||||
from urllib.parse import quote
|
||||
|
||||
from django.utils import formats
|
||||
@ -967,12 +966,3 @@ def pluralize(value, arg="s"):
|
||||
def phone2numeric_filter(value):
|
||||
"""Take a phone number and converts it in to its numerical equivalent."""
|
||||
return phone2numeric(value)
|
||||
|
||||
|
||||
@register.filter(is_safe=True)
|
||||
def pprint(value):
|
||||
"""A wrapper around pprint.pprint -- for debugging, really."""
|
||||
try:
|
||||
return pformat(value)
|
||||
except Exception as e:
|
||||
return "Error in formatting: %s: %s" % (e.__class__.__name__, e)
|
||||
|
@ -12,9 +12,7 @@ class DjangoRepr(reprlib.Repr):
|
||||
setattr(self, attr, limit)
|
||||
|
||||
def repr_str(self, x, level):
|
||||
if len(x) > self.maxstring:
|
||||
return x[: self.maxstring] + self.gen_trim_msg(len(x))
|
||||
return x[: self.maxstring]
|
||||
return "'%s'" % (x[: self.maxstring] + self.gen_trim_msg(len(x)))
|
||||
|
||||
def repr_instance(self, x, level):
|
||||
s = builtins.repr(x)
|
||||
|
@ -358,13 +358,13 @@ class ExceptionReporter:
|
||||
if "vars" in frame:
|
||||
frame_vars = []
|
||||
for k, v in frame["vars"]:
|
||||
|
||||
try:
|
||||
if isinstance(v, Sized) and len(v) > self.PRINT_LIMIT:
|
||||
diff = len(v) - self.PRINT_LIMIT
|
||||
self.repr_instance.fillvalue = (
|
||||
"...<trimmed %d bytes string>" % diff
|
||||
)
|
||||
|
||||
v = self.repr_instance.repr(v)
|
||||
|
||||
except Exception as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user