On Jul 19, 2007, at 10:36 AM, Roger Ineichen wrote:

Hi Tobias

Auftrag von Gary Poster
Gesendet: Donnerstag, 19. Juli 2007 15:53
An: Tobias Rodäbel

[...]


zope.app.keyreference-3.5.0_dev_r77018-py2.4.egg requires
ZODB3>=3.9.0-dev-r77011

But there might be a caching problem within ZODB3-3.9.0 dev
r77011,
my debug session tells:

/development/Zope3/MyProject/eggs/ZODB3-3.9.0_dev_r77011-py2.4-
macosx-10.4-ppc.egg/ZODB/Connection.py(644)_store_objects()
-> raise
(Pdb) obj
<zope.app.file.image.Image object at 0x3faadb0>
(Pdb) oid
'\x00\x00\x00\x00\x00\x00\x00\xc6'
(Pdb) self._cache[oid]
*** KeyError: '\x00\x00\x00\x00\x00\x00\x00\xc6'
(Pdb) self._cache[oid] = obj
*** TypeError: Cache values must be persistent objects.

But zope.app.file.image.Image should be persistent.

[...]

Looking forward to some hints or help,

Hi Tobias.  The ZODB 3.9 dev version is only different from 3.8 in
some conflict resolution code, for which I am responsible.  Some
thoughts.

I'm pretty shure you ve got a LocationProxy arround your object
because the zope.app.file doesn't implement ILocation.

Hey Roger.  I bet you are right.

...

Gary
-----

This happens because of the call in

ZODB.Connection.py
$Id: Connection.py 75693 2007-05-11 22:18:37Z jim $
cool that we have the revision info in the file header ;-)
line: 627

except:
    # Dang, I bet it's wrapped:
    # TODO:  Deprecate, then remove, this.
    if hasattr(obj, 'aq_base'):
        self._cache[oid] = obj.aq_base
    else:
        raise

My question is, can we improve the method:
if hasattr(obj, 'aq_base')
and remove the proxy with a method that works?


I mentioned this to Jim. If the masking of the original exception doesn't appear to lose any useful information, he'd prefer something like

if type(obj) is not obj.__class__:
    raise ValueError('object appears to be proxied', obj)
else:
    raise

IOW, don't guess, but give a more helpful error message

Gary_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to