I had the bright idea of defining a mixin class whose methods I
thought I could use in my regular Zope product classes:

class AMixin:
  def __init__(self):
     blah, blah blah

class B(AMixin, Persistent, Folder, ....):
  def __init__(self):
    # do some of my own stuff

This fails with the warning (as I recall) that the unbound method
AMixin.__init__ needs to be called with an instance as its first
argument.  (I've stripped the example down to give what I think are
the essentials).

self in the context of B is an Extension class, and I'm guessing this
is making AMixin unhappy because it's not.  I assume I'll have the
same problem with other methods that I attempt to access using

Can anyone confirm this diagnosis?  And what's the best solution?

I have redefined things
class AMixin:
  def _mixin_init(self):

class B(AMixin, .....):
   def __init__(self):
    #my own stuff

and this seems to work, but I wonder if there's a way to get the
classes to play together better (maybe "class AMixin(ExtensionClass):"?
though since ExtensionClass is a type I guess that's not exactly it).

This was after already discovering that isinstance doesn't work with
ExtensionClass (which I see confirmed on the list, along with the fact
that ExtensionClass generally has a lot of rough spots and may be on
the way out).  This is with Zope 2.5.1.

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to