[Zope3-dev] Zope3 magic makes me cranky.

Anthony Baxter anthony@interlink.com.au
Tue, 15 Jul 2003 01:27:40 +1000


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

There also appears to be some sort of bug that this stuff is triggering
with pdb - every second time I try and access self.context.
(Pdb) p self.context
*** NameError: <exceptions.NameError instance at 0x431d8f6c>
(Pdb) p self.context
<zope.schema._field.BytesLine object at 0x431e67ac>
(Pdb) p self.context
*** NameError: <exceptions.NameError instance at 0x431d8f6c>
(Pdb) p self.context
<zope.schema._field.BytesLine object at 0x431e67ac>

This also didn't make working out what's going on any easier, and most
likely is responsible for my crankiness right now.

Anthony