[Zope3-Users] nextURL: add vs edit

Gary Poster gary at zope.com
Fri Feb 17 19:42:22 EST 2006


On Feb 17, 2006, at 6:42 PM, Shaun Cutts wrote:

>
>
>> On Behalf Of Garanin Michael
>> What is mixin? Is it content-object or view?
>
> Well, I think in the wider python context "mixin" is something that  
> you
> can use as a base class to extend the functionality of your class,
> assuming you provide some standard interface. (e.g.  
> UserDict.DictMixin.)

Right.

> I'm not sure whether zope uses "mixin" exactly like this,

Yup.

> or whether it
> extends "mixin" for something that you don't have to have in the class
> hierarchy, but acts as if it were because of traversal (so perhaps: An
> instance is give a special base class of its own that defines
> __getattr__ and uses it to search for missing methods in the wider
> context? I don't know but I'm a bit wary of the traversals without  
> more
> study. They seem to be playing with normal python resolution in a way
> that isn't clear to me.)
>
> In this case, I got the term from the ++apidoc++ for the zcml
> editform.class attribute:
>
>> A class to provide custom widget definitions or methods to be used by
> a
>> custom template.
>
>> This class is used as a mix-in class. As a result, it needn't  
>> subclass
> any
>> special classes, such as BrowserView.
>
> And so, my "mixin" is indeed a view... or at least, it acts like a  
> view.
> But I'm a bit hazy on how it is actually constructed and "where" it is
> wrt the EditView object. Is the factory (the class I pass in
> editform.class) passed in "bases" to SimpleViewClass(... ) in
> zope.app.forms.browser.editview.EditViewFactory? Then the EditView and
> my mixin are both bases of a specially constructed BrowserView
> derivative?

Yes, constructed dynamically by the magic editform zcml.  This is  
precisely the sort of magic that many folks dislike in some of the  
zcml directives.  We are trying to move away from it, and formlib  
lets you, in this particular case.

Gary


More information about the Zope3-users mailing list