Am Donnerstag, den 25.01.2007, 08:37 +0000 schrieb Alek Kowalczyk: > Hi, > I am looking for some filtering adapter for containers. You know, the object > which can adapt an IMyContainer to another IMyFilteredContainer, listing only > items which fall into some filter criteria. > I thought it may be quite common pattern, but couldn't find any generic, > already > done solution - and I started to suspect I should do that another way. > Should I move that functionality to view? I don't like that solution too much > - > I feel that this kind of filtering is still rather model logic than view > logic, > but may be I'm wrong.
So, you could implement the container interface that has an additional
method "filter" which takes an object and returns true/false.
Then you could use an adapter IFilteredContainer like this:
filtered = IFilteredContainer(container)
filtered.filter = lambda x:x.__name__.startswith('s')
Filtered would then work like a normal container. I'd suggest using the
read interface only unless you are very sure what "filtering" on the
write interface means.
Christian
--
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Zope3-users mailing list [email protected] http://mail.zope.org/mailman/listinfo/zope3-users
