[Zope] loop over non sequence !!!

sanjeev c s sanju22_us@yahoo.com
Thu, 29 Nov 2001 06:24:51 -0800 (PST)


Thank you,
It works !!!
regards,
Sanju.
--- Casey Duncan <c.duncan@nlada.org> wrote:
> On Thursday 29 November 2001 08:45 am, sanjeev c s
> allegedly wrote:
> > hello,
> > I want to delete last item from a folder,
> everytime
> > the method is called.
> > suppose name of the folder is pics
> > so in a DTML method i say
> >
> ---------------------------------------------------
> > <dtml-in expr="pics.objectValues()">
> > <dtml-if sequence-end>
> > <dtml-call "pics.manage_delObjects(id)">
> > </dtml-if>
> > </dtml-in>
> > ----------------------------------------------
> > i get a error saying
> > Error Type: TypeError
> > Error Value: loop over non-sequence
> >
> > Please help me.
> > regards,
> > Sanju.
> 
> Try:
> 
> <dtml-let last_id="pics.objectIds()[-1]">
>   <dtml-call expr="pics.manage_delObjects(last_id)">
> </dtml-let>
> 
> This would be much better as a Python script tho.
> Then it would be:
> 
> last_id = context.pics.objectIds()[-1]
> context.pics.manage_delObjects(last_id)
> 
> hth,
>
/---------------------------------------------------\
>   Casey Duncan, Sr. Web Developer
>   National Legal Aid and Defender Association
>   c.duncan@nlada.org
>
\---------------------------------------------------/


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1