[Zope] (sort of teaser) Re: [Zope] Recursive aquisition: good
or bad?
Michel Pelletier
michel@digicool.com
Tue, 8 Jun 1999 09:51:22 -0400
> -----Original Message-----
> From: Anthony Baxter [mailto:anthony@interlink.com.au]
> Sent: Tuesday, June 08, 1999 5:57 AM
> To: Tom Schwaller
> Cc: zope@zope.org
> Subject: [Zope] (sort of teaser) Re: [Zope] Recursive aquisition: good
> or bad?
>
> In more detail, the problem I have is that in the
> bobo_traverse method, if
> I get a constraint, I want to store this. The way I do this
> is to instantiate
> a new DMC - but one that's non-persistant, populate it, then
> return it.
> Unfortunately to get it to acquire everything else it needs,
> I need to
> attach it to the 'self' object with something like
>
> self.new = DMC_nonP(self.id, self.name, ....)
> ... set the magic in the new object ...
> return self.new
>
> Unfortunately this self.new assignment makes an entry in the
> ZODB. Blah.
>
You could call it self._v_new and the persistence machinery will never
store it in the database. Attributes starting with _v_ are 'volitile'.
Do you want your new DMC_nonP objects to acquire from 'self' as their
parent? You can do this without an assignment (I think this is right,
never atctually put it to the test):
x = DMC(...)
return x.__of__(self)
x must inherit ExtensionClass.Base to get this machinery. This returns
an Acquisition wrapped object whose ac_parent is 'self'.
-Michel the Acquired
inherit at least ExtensionClass.Base to do this.
> Anyway, I plan to fling a release of some sort out tonight, bug or no
> bug.
>
> Anthony
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>