RE: [Zope] (sort of teaser) Re: [Zope] Recursive aquisition: good or bad?
-----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 )
Michel Pelletier wrote:
x = DMC(...) return x.__of__(self)
x must inherit ExtensionClass.Base to get this machinery.
Actually, both x and self must be ExtensionClass instances. One way to be an extension class is to subclass Base, but Persistent is an extension class too that is not a subclass of Base. x must have an __of__ implementation. Not all extension classes implement __of__. In this case, x's class wants to subclass one of the acquisition base classes, Implicit or Explicit. Jim -- Jim Fulton mailto:jim@digicool.com Technical Director (540) 371-6909 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
Michel Pelletier wrote 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'.
ooo - thanks. hm - I tried both these, but stuff still gets written to the bobobase. Ah well, I'll release the code in a few minutes, someone else can look at it and point out what stupid thing I'm doing. Anthony
participants (3)
-
Anthony Baxter -
Jim Fulton -
Michel Pelletier