[Zope3-dev] Zope3 magic makes me cranky.
Fred L. Drake, Jr.
fred@zope.com
Mon, 14 Jul 2003 11:45:53 -0400
Anthony Baxter writes:
> 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.
For widgets in particular, a bunch of the magic can probably be
avoided simply by changing the ZCML. The widgets could be configured
using <view> elements instead of <page> elements to avoid a lot of
extra cruftiness being invoked by the <page> directive, with a side
effect of (very slightly) improved startup time.
In the general case, you're right: the magically generated classes
need to be clearly marked, where they're necessary at all.
-Fred
--
Fred L. Drake, Jr. <fred at zope.com>
PythonLabs at Zope Corporation