[Zope] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Marco Bizzarri
Hi all. I need to query a ZCatalog, and I would like to know how many elements are there. I'm working from inside a python product, so, I could do something like: results = Catalog(criteria) return len(results) But this creates a number of objects which are completly useless for me. After all,

Re: [Zope] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Janko Hauser
Am 05.06.2008 um 12:56 schrieb Marco Bizzarri: Hi all. I need to query a ZCatalog, and I would like to know how many elements are there. I'm working from inside a python product, so, I could do something like: results = Catalog(criteria) return len(results) But this creates a number of

Re: [Zope] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Marco Bizzarri
On Thu, Jun 5, 2008 at 1:28 PM, Janko Hauser [EMAIL PROTECTED] wrote: Am 05.06.2008 um 12:56 schrieb Marco Bizzarri: Hi all. I need to query a ZCatalog, and I would like to know how many elements are there. I'm working from inside a python product, so, I could do something like: results

Re: [Zope] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Tino Wildenhain
Hi, Marco Bizzarri wrote: ... if result: result_len = results.actual_result_count else: result_len = 0 return result_len ... Thanks for your answer, but there is something I do not understand: if results: an empty result from ZCatlog is false in a boolen condition? Yes, thats

Re: [Zope] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Marco Bizzarri
On Thu, Jun 5, 2008 at 3:35 PM, Tino Wildenhain [EMAIL PROTECTED] wrote: Hi, Marco Bizzarri wrote: ... if result: result_len = results.actual_result_count else: result_len = 0 return result_len ... Thanks for your answer, but there is something I do not understand: if results: