#6021 closed (fixed)
RuntimeError when printing a SafeString
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | print recursion | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
SafeString's __str__
method does not return a string but the SafeString object itself. Simply removing the __str__
method seems to solve the problem (all tests pass).
>>> from django.newforms.util import ErrorList >>> e = ErrorList([u'foo']) >>> e [u'foo'] >>> type(str(e)) <class 'django.utils.safestring.SafeString'> >>> print e Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: print recursion
Attachments (1)
Change History (8)
by , 17 years ago
Attachment: | recursion.diff added |
---|
comment:1 by , 17 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
follow-up: 3 comment:2 by , 17 years ago
I have verified that all the tests pass as well. Talked to Malcom and this seems to be an appropriate solution.
comment:3 by , 17 years ago
Replying to trey@ktrl.com:
I have verified that all the tests pass as well. Talked to Malcom and this seems to be an appropriate solution.
Let me try that while logged in.
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 17 years ago
Could this possibly be what caused the "Exception Value: maximum recursion depth exceeded Exception Location: usr/local/lib64/python2.5/site-packages/django/utils/safestring.py in __add__, line 73" reported in #6071?
comment:6 by , 17 years ago
Karen: no. That's more brain damage on my part. Trey also fixed that yesterday and I'll commit it shortly.
comment:7 by , 17 years ago
Cc: | removed |
---|
I can reproduce this and the patch solves the problem.