security proxy breaks python expectation w/ str and repr
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Won't Fix
|
Undecided
|
Unassigned | ||
zope.security |
Won't Fix
|
Wishlist
|
Unassigned |
Bug Description
In Python, when an object has a __repr__() but no __str__(), and str() is called on that object, Python will fall back to calling __repr__(), as documented here:
http://
>>> class Foo(object):
... def __repr__(self): return 'my repr'
...
>>> repr(Foo())
'my repr'
>>> str(Foo())
'my repr'
However, Zope's security proxy does not mimic this behavior correctly. In the following, listx is an object of type MailingList which has a __repr__() but no __str__():
>>> str(listx)
'<security proxied canonical.
>>> repr(listx)
'<MailingList for team "teamx"; status=ACTIVE at 0xa7aca2c>'
The str(listx) should print the same thing as repr(listx)
Changed in zope3: | |
status: | New → Won't Fix |
Changed in zope.security: | |
importance: | Undecided → Wishlist |
status: | New → Triaged |
Now tracked on Github:
https:/ /github. com/zopefoundat ion/zope. security/ issues/ 7