[Zope] Query to ZODB

Robert Rottermann robert@redcor.ch
Wed, 20 Feb 2002 07:54:46 +0100


Do something like this:
p={}
for good in context.objectItems('goods'): 
  #in ('goods') goods is the type of object you are using 
  if(good.hasProperty('producer'):
    p[good.getProperty('producer')] = 1
producers = p.keys()

----- Original Message ----- 
From: "Mikhail" <miha@instock.ru>
To: <zope@zope.org>
Sent: Wednesday, February 20, 2002 6:24 AM
Subject: [Zope] Query to ZODB


> Hi all,
> 
> Please help me to solve my new problem :(
> 
> How I can take list of all unique properties in folder with same
> objects?
> 
> Example 
>   goods/
>      goods_1 (producer=Type1)
>      goods_2 (producer=Type2)
>      goods_3 (producer=Type1)
>      goods_4 (producer=Type3)
>      goods_5 (producer=Type1)
> 
> And I wont to receive:
>     producers = ('Type1', 'Type2', 'Type3')
> 
> -- 
> WBR, Mikhail
> ZSP Instock (http://www.instock.ru/)
> 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>