Mike Pelletier wrote:
Is there an inverse operation to:
obj = obj.aq_base
No, unless you happen to have the parent around. Why are you using aq_base in the first place? (snip)
I think I'm relying too much on Zen and not enough on actual understanding.
Zen is understanding. I think you are relying on lore, which looks like, but is not Zen. ;)
When should I care whether I'm dealing with an object, or an object's Aquisition proxy?
Almost never. (The security machinery cares alot, but that's our problem, not yours. ;) A very common reason to use aq_base is to temporarily disable acquisition, for example, to test whether an object as an (unacquired) attribute. There is "now" (meaning in the public CVS and in the next release) a better way to prevent acquisition. Acquisition wrappers now have a new attribute, 'aq_explicit' that returns a new wrapper that is explicit. So, if you want to see if 'obj' has an unacquired attribute, 'spam', you could use: if hasattr(obj.aq_explicit, 'spam'): ... The inverse of aq_explicit is __of__: e=obj.aq_explicit o=e.aq_self.__of__(e.aq_parent) Here 'o' is wrapped the same way 'obj' was. Also note that "now" aq_base is not allowed in DTML.
I'm having a lot of trouble with my code acting differently after a restart, and I think it's due to either too many or too few aq_bases.
It is more likely that you have some sort of persistence problem, such as a pickling problem or a broken persistence rule. (http://www.zope.org/Documentation/Models/ZODB/ZODB_Persistent_Objects_Persis...) One problem we have is that errors that occur during unpickling are not easy to see. :( We ought to fix this, but it's hard, since these errors occur in strange places where error reporting may be unexpected or unwelcomed. I do have an idea for making things better. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.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.