[Zope] Creating a ZClass instance as a method of another ZClass?

Phillip J. Eby pje@telecommunity.com
Fri, 10 Dec 1999 12:49:01 -0500


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.  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 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.