5 Jun
2008
5 Jun
'08
1:35 p.m.
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 standard Python behavior, empty lists, dictionaries and similar objects are assumed "False" when used as boolean. This means you could even write it this way: return (results and results.actual_result_count) or 0 in python2.5 (not yet supported by Zope) even: return results.actual_result_count if results else 0 Cheers Tino