[Zope] Need some help to get rid of an InvalidObjectReference exception

Dieter Maurer dieter at handshake.de
Tue Aug 19 14:16:24 EDT 2008


chaouche yacine wrote at 2008-8-18 09:50 -0700:
>Need some help to get rid of an InvalidObjectReference exception
>In my zope product, when I try to put some specific object in the session, I get this :
>
>2008-08-18T14:51:02 ERROR(200) SiteError http://www.afdas.com:8091/noyauafdas/tests/testAdresses
>Traceback (most recent call last):
>  File "/opt/Zope-2.7/lib/python/ZPublisher/Publish.py", line 107, in publish
>    transactions_manager.commit()
>  File "/opt/Zope-2.7/lib/python/Zope/App/startup.py", line 222, in commit
>    get_transaction().commit()
>  File "/opt/Zope-2.7/lib/python/ZODB/Transaction.py", line 241, in commit
>    ncommitted += self._commit_objects(objects)
>  File "/opt/Zope-2.7/lib/python/ZODB/Transaction.py", line 356, in _commit_objects
>    jar.commit(o, self)
>  File "/opt/Zope-2.7/lib/python/ZODB/Connection.py", line 452, in commit
>    dump(state)
>InvalidObjectReference: Attempt to store an object from a foreign database connection

A given persistent object can only be in one (ZODB-) database, not in several
databases at the same time.

You must copy the persistent object, when you want it to be stored
(also) in another (ZODB-) database.

You can use the "_getCopy(destination)" method to create such
a copy. "_getCopy" is defined by "OFS.CopySupport.CopySource" inherited
by most Zope objects.



-- 
Dieter


More information about the Zope mailing list