[Zope3-dev] Re: Zope3 magic makes me cranky.

Jim Fulton jim@zope.com
Mon, 14 Jul 2003 16:55:01 -0400


Anthony Baxter wrote:
> I put a line
>     import pdb ; pdb.set_trace()
> in zope/app/browser/form/widget.py:Widget.row() (line 205 in current-cvs).
> I then run something that displays an add form, and look at the pdb window:
> 
> (Pdb) p self
> <zope.app.publisher.browser.viewmeta.BytesWidget object at 0x40f4960c>
> 
> This class doesn't exist.

Sure it does.

 > According to SteveA on IRC, this is because
> 'self' here is actually a view being constructed with some sort of 
> mixin fun. If this is the case, could we please get a decent __class__ 
> that indicates this? I just spent far too long slamming my head against 
> this trying to figure out what the heck I was actually dealing with.


The view is an instance of a generated class.  The class is generated
so that it includes the zcml-specified template and has the necessary
permission specification.

Perhaps it would be better of the class showed up as something like:

   <generated class based on class foo.bar.baz and template splat.py with permission zope.ManageContent object at 0x40f4960c>


> There also appears to be some sort of bug that this stuff is triggering
> with pdb 

I seriously doubt that the use of a generated class is affecting pdb.
It's more likely that this is a thread interaction.

Jim


-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org