[Zope3-dev] Zope3 magic makes me cranky.

Steve Alexander steve@cat-box.net
Mon, 14 Jul 2003 19:47:21 +0300


> But I think this was something that Jim wanted to support easier
> entrance to using Zope 3.  If we can convince him that this is
> misguided, that would be a good thing, and would allow a lot of
> simplification in this case.  And we wouldn't need such magically
> incanted classes.

The trade-off is having more boiler-plate. Fortunately, now we have a 
nice interface 'implements()' function, and a zope.app.zapi module to 
import things from conveniently, there is much less boiler-plate required.


With magic:

   class Foo:

       def presentBar(self):
           return unicode(self.context.bar * 10)


Without magic:

   from zope.app import zapi

   class Foo(zapi.BrowserView):

       def presentBar(self):
           return unicode(self.context.bar * 10)


I think the magic was a good idea when first introduced. There was more 
boiler-plate then.

I think it is safe to remove the magic now that the boiler-plate is 
reduced to only a few extra characters.

--
Steve Alexander