[zope2-tracker] [Bug 719335] [NEW] unicode calls __str__ for acquisition wrapped objects
Michael Howitz
719335 at bugs.launchpad.net
Tue Feb 15 08:23:27 EST 2011
Public bug reported:
unicode(<some_object>) calls the __unicode__ method of the object
but unicode(<some_aq_wrapped_object>) calls __str__
See the following bin/zopectl debug session:
$ bin/zinstance debug
Starting debugger (the name "app" is bound to the top-level Zope object)
>>> import OFS.SimpleItem
>>> class A(OFS.SimpleItem.SimpleItem):
... def __str__(self): return '__str__ called'
... def __unicode__(self): return '__unicode__ called'
...
>>> a = A()
>>> print unicode(a)
__unicode__ called
>>> print unicode(a.__of__(app))
__str__ called
>>> print type(a.__of__(app))
<type 'Acquisition.ImplicitAcquisitionWrapper'>
This happens for Python 2.6 and 2.7 on Zope 2.13.4.
** Affects: acquisition
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Zope 2
Developers, which is the registrant for Acquisition.
https://bugs.launchpad.net/bugs/719335
Title:
unicode calls __str__ for acquisition wrapped objects
More information about the zope2-tracker
mailing list