[Zope] getting the number of returned objects
Chris McDonough
chrism@zope.com
Sat, 20 Oct 2001 15:21:42 -0400
Getting the number of results returned by a Catalog query is a thing
that folks commonly want to do, and usually just doing len(resultset)
works OK. I'm surprised it didn't for you.
That said, it's an extremely expensive operation under some
circumstances because it un-lazifies the carefully-lazified Catalog
resultset, creating a brain object for each matching catalog record. If
there's a way to not do this in your application, I'd recommend it.
Timothy Wilson wrote:
> Hi everyone,
>
> Let's say I've got a PythonScript called 'getResults' that does a catalog
> query. What is the proper way to get how many results were returned by
> getResults in DTML? For example, <dtml-var "len(getResults)"> doesn't
> work (I didn't think it would). I've tried some other variants without
> success. Any ideas?
>
> -Tim
>
> --
> Tim Wilson | Visit Sibley online: | Check out:
> Henry Sibley HS | http://www.isd197.org | http://www.zope.com
> W. St. Paul, MN | | http://slashdot.org
> wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
>
>
> _______________________________________________
> 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 )
>
--
Chris McDonough Zope Corporation
http://www.zope.org http://www.zope.com
"Killing hundreds of birds with thousands of stones"