[Zope3-dev] Zope3 magic makes me cranky.

Steve Alexander steve@cat-box.net
Mon, 14 Jul 2003 20:00:36 +0300


> Doesn't this mixin magic occur for all browser views? E.g. the
> 'editform' directive makes sure EditForm is mixed into the class
> specified by 'class' (seems to anyway). While this is a bit subtle, it's
> better than forcing developers to subclass EditForm in order to specific
> an 'editform' class.
> 
> OTOH, maybe a startup check is in order, which could easily inform a
> developer that 'class' (used in the editform directive) must subclass
> EditForm. 

That's a good idea.

It should be a check that an IEditForm interface is implemented by the 
class. If you explicitly mix in an EditForm base-class, this interface 
is provided for you. If you choose not to do so, you have to make sure 
you fulfil that contract, and implement the interface.

Again, this is only one extra line of code with zapi:

from zope.app import zapi

class MyEditForm(zapi.EditForm):

   # ... methods etc.


--
Steve Alexander