[Zope] Python Script Question

Jud Dagnall lists at dagnall.net
Fri May 14 15:10:50 EDT 2004


On Fri, 2004-05-14 at 09:54, Laura McCord wrote:
> I am starting out with this in my script
> 
> RESPONSE = context.REQUEST.RESPONSE
> success = 0
> for id in context.objectIds():
>    success = success + 1
> return success
> 
> 
> All this does is count the contents in the folder. However, how do you
> specify what content to count. For instance, I do not want this script
> to count itself in the folder contents but I want it to include
> everything else. Any suggestions?

Trivial case:

if success: return success - 1
else: return 0

Otherwise, you can provide objectIds a list of content types to include
(see the Zope API Refererence), or you can manually exclude types by
checking inside your loop.


-- 
Jud <lists at dagnall.net> 
http://www.dagnall.net




More information about the Zope mailing list