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

I'm not sure whether zope uses "mixin" exactly like this, 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
> custom template.

> This class is used as a mix-in class. As a result, it needn't subclass
> 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

That's my best guess without more study of the code.

- Shaun

Zope3-users mailing list

Reply via email to