Hello everyone,<br><br>I'm sporadically getting the following error thrown as a result of a routine I've written.<br><br>InvalidObjectReference: Attempt to store a reference to an object from a separate connection to the same database or multidatabase.
<br><br>I can often run this routine several times without a problem.&nbsp; After a fresh Zope (re)start, this error never happens on the first run.&nbsp; Once the problem does occur I need to restart Zope to make it go away.<br><br>
Can anyone tell me what this error actually means, and what bad practices could cause it?<br><br>I've found a couple of hits about &quot;InvalidObjectReference: Attempt to store an object from a foreign database connection error&quot; in the archives, but I don't know how close this is to my problem.
<br><br>An example traceback would be:<br>-----------------------------------------------<br>2006-11-08T16:47:49 ERROR Zope.SiteErrorLog <a href="http://localhost:8080/WebSites/dev/test1/manage_publish">http://localhost:8080/WebSites/dev/test1/manage_publish
</a><br>Traceback (innermost last):<br>&nbsp; Module ZPublisher.Publish, line 115, in publish<br>&nbsp; Module ZPublisher.mapply, line 88, in mapply<br>&nbsp; Module ZPublisher.Publish, line 41, in call_object<br>&nbsp; Module Products.DWT.WebBase
, line 756, in manage_publish<br>&nbsp; Module Products.DWT.WebBase, line 724, in manage_publish<br>&nbsp; Module OFS.CopySupport, line 564, in _getCopy<br>&nbsp; Module transaction._manager, line 110, in savepoint<br>&nbsp; Module transaction._transaction, line 295, in savepoint
<br>&nbsp; Module transaction._transaction, line 292, in savepoint<br>&nbsp; Module transaction._transaction, line 675, in __init__<br>&nbsp; Module ZODB.Connection, line 1012, in savepoint<br>&nbsp; Module ZODB.Connection, line 526, in _commit
<br>&nbsp; Module ZODB.Connection, line 553, in _store_objects<br>&nbsp; Module ZODB.serialize, line 407, in serialize<br>&nbsp; Module ZODB.serialize, line 416, in _dump<br>&nbsp; Module ZODB.serialize, line 341, in persistent_id<br>InvalidObjectReference: Attempt to store a reference to an object from a separate connection to the same database or multidatabase
<br>-----------------------------------------------<br><br>I'm only dealing with one ZODB, so perhaps this is a multiple connection issue (although I have no idea how/why).<br><br>In case it helps to know the context of the problem, I have a collection of objects I've written:
<br><br>1) WebSite, based on OrderedFolder<br>2) WebSection, based on OrderedFolder<br>3) WebPage, based on ZopePageTemplate<br>4) WebImage, based on Image.<br><br>Each of these classes inherit a common base of functionality from a WebBase class.&nbsp; The manage_publish() method, defined in WebBase, copies the current object (one of #'s 2-4) to the same relative path within the context of another WebSite.&nbsp; This gives me a basic &quot;dev&quot; to &quot;live&quot; publishing process.
<br><br>Perhaps the most complex part of this routine is its ability to recurse.&nbsp; For example, a WebPage on the dev WebSite will first call its parent WebSection's manage_publish() if the parent WebSection doesn't exist on the live WebSite.
<br><br>Other things do happen during the process which might be causing this InvalidObjectReference, but if I can get a grip on what kinds of programming offenses causes this exception then I can make a more educated review of my code.&nbsp; I will happily provide a copy of the source if anyone is interested or thinks it will be useful. 
<br><br>Thank you for any help or advice!<br>Garth<br>