Re: [Zope] Creating a ZClass instance as a method of another ZClass?
On Fri, 10 Dec 1999 14:38:27 -0500 (EST), Jeff K. Hoffman wrote:
On Fri, 10 Dec 1999, Phillip J. Eby wrote:
At 12:11 PM 12/10/99 -0500, Jeff K. Hoffman wrote:
With the cursor sitting on this line in the debugger, I tried:
pdb> p folder[id] <BClass instance at ...> pdb> s # this executes the getattr(folder, id) line AttributeError: 'binstance'
It is obvious that my instance has been created, and installed into the methods instance via _setObject(), so I am baffled as to why folder[id] works but getattr(folder, id) does not.
Can anyone shed any light on this, for me? Am I trying to do something that's outside the capabilities of ZClasses, or have I just missed something obvious?
Currently, ZClass instances can only be added to objects which store them in a way accessible with getattr. And evidently, ZClasses themselves do not do that, so you can't add a ZClass instance to a ZClass.
Ok. Just wanted to make sure I wasn't doing something taboo.
This is a bug in the ZClass instance logic, and I know Michel Pelletier knows about it (at least, another place where it shows up), but I don't know if it has been reported to the collector or a fix is actively in the works.
I found the following, which was posted back in July:
http://classic.zope.org:8080/Collector/386/view
It seems it was fixed, but apparently it has been broken again. I will submit it to the collector in the form of my previous message.
I may take a look at this and see if I can submit a patch to speed the fix process, as putting ZClass instances into ZClasses is something which will be very important to me in the near future.
Keep us posted on how things go. I will see what I can do, on this end, too. But, since I am still learning, you'll probably be able to fix it much faster than I. :)
I'm puzzled -- I can add ZClass instances from one of my products to ZClass instances from another of my products through the management interface just fine, on both 2.01 and 2.1. I can't believe that there is any functionality possible through the management interface which can't also be had through Python. Tres. -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
On Fri, 10 Dec 1999, Tres Seaver wrote:
I'm puzzled -- I can add ZClass instances from one of my products to ZClass instances from another of my products through the management interface just fine, on both 2.01 and 2.1.
I am not trying to add a ZClass instance from a product to a ZClass instance of another product. I am trying to add a ZClass instance from a product to the ZCLASS of another product; I am trying to add an instance of BClass to the 'Methods' tab of AClass, such that 'myBClassInstance' will be available to all instances of AClass. Maybe this will clear it up: + Control_Panel + ProductB + BClass (ZClass) + Methods tab - one (DTML Method) - two (DTML Method) + ProductA + AClass (ZClass) + Methods tab - myBClassInstance (BClass instance) - index_html (DTML Method) + aInstance1 (AClass instance) + aInstance2 (AClass instance) Thus, aInstance1 and aInstance2 both have a 'myBClassInstance' method, as defined in the AClass ZClass (heh, isn't that a mouthful. :-))
I can't believe that there is any functionality possible through the management interface which can't also be had through Python.
Neither can I. ;-) Good thing there isn't, as far as I know. --Jeff
participants (2)
-
Jeff K. Hoffman -
Tres Seaver