[Zope-CMF] Re: five.intid and DirectoryView

Ross Patterson me at rpatterson.net
Fri Jun 27 12:53:54 EDT 2008


"Martijn Pieters" <mj at zopatista.com> writes:

> On Thu, Jun 26, 2008 at 10:08 PM, Ross Patterson <me at rpatterson.net> wrote:
>> But since the FSObjects provide IPersistent, they can be added to a
>> connection.  If they're added to a connection, the object can be
>> ghosted when that connection is closed.  If another thread
>> subsequently consults the DirectoryView registry for the same object,
>> the persistnce machinery will raise ConnectionStateError when it
>> tries to de-ghost the object from the closed connection.
>
> But the code never does that. When cloning a file-based FSObject, a
> new instance is created and that is added to the ZODB. Noone else
> should do this either.

zope.app.keyreference does.  The persistence machinery doesn't add an
object to a connection until commit.  As such, an IPersistent and
IObjectAdded event handler, such as the one in zope.app.intid, that
needs the object to have a connection needs to add the object to a
connection.

Shouldn't anything that implements IPersistent be able to be added to a
connection?  Wouldn't that be considered part of providing the
interface?  Where else is an object that provides IPersistent stored in
global state?

Ross



More information about the Zope-CMF mailing list