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. __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1
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 \---------------------------------------------------/
* Casey Duncan <c.duncan@nlada.org> [011129 14:12]:
On Thursday 29 November 2001 08:45 am, sanjeev c s allegedly wrote:
hello, <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
last_id = context.pics.objectIds()[-1] context.pics.manage_delObjects(last_id)
Off the top of my head, the TypeError is probably because you're passing a string rather than a list to delObjects (note the plural) - so it should be last_id = context.pics.objectIds()[-1] context.pics.manage_delObjects((last_id,)) seb
participants (3)
-
Casey Duncan -
sanjeev c s -
seb bacon