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

Jeff K. Hoffman jkhoffman@carolina.rr.com
Fri, 10 Dec 1999 14:38:27 -0500 (EST)


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

Thanks,

--Jeff