[Zope3-dev] Re: partial adapters
Garrett Smith
garrett at mojave-corp.com
Fri Jul 30 09:36:18 EDT 2004
Steve Alexander wrote:
> Garrett Smith wrote:
>
>> Did partial adapters ever make it into 3.0?
>
> Why do you want partial adapters? Would subscription adapters do what
> you need?
>
It's the use case cited in the proposal -- multiple sources of
'sublocations' (I'm calling them subobjects). I'm handling it with three
adapters, one of which coordinates the use of the other two.
Here's what it looks like:
class ISubobjects:
"""Provides subobjects for an object."""
def __iter__():
"""Iterates all of an object's subobjects."""
I'm using it as follows (obvious):
for subobject in ISubobjects(object):
doSomething(subobject)
One of the adapters knows about object attributes and another about
container items. The third coordinates the use of the two, iterating
object attributes first, then container items.
I'm happy with what I have now, but recalled that this was one of the
drivers behind partial adapters. Though admitedly, I don't think I fully
understood partials :-)
-- Garrett
More information about the Zope3-dev
mailing list