Hopefully this is enough context for this question.

When I subclass Acquisition.Implicit or .Explicit, I find myself
losing the foo["item"] and foo[slice:slice] syntax.  __getslice__ and
__getitem__ aren't affected.

When I don't subclass Acquisition, the [] syntax works fine.

I can get them back by explcitly redefining them __getslice__ and
__getitem__ (even though those methods never had any problems), but is
there a better way around this?

I'm doing a lot of other craaazzy stuff with these classes, I may be
causing this problem myself elsewhere.  I'm not defining
foo.__getslice__, rather I'm defining __getattr__ in a superclass, and
returning the result of a call on a proxied object for attr names that
match a list.

But this does look like the [] syntax is running into the fact that
you need to call inheritedAttribute rather than the superclass method
directly, or something.

Here's what I'm doing to make this work:


class ManageableNodeList(ManageableWrapper, DOMProxy.NodeListProxy, 
Acquisition.Implicit):

    def __getslice__(self, i, j):
        return self.__getattr__("__getslice__")(i,j)

    def __getitem__(self, i):
        return self.__getattr__("__getitem__")(i)        


-- 
Karl Anderson                          [EMAIL PROTECTED]

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

Reply via email to