Hi, <tr tal:repeat="file batch" bordercolor="#0099FF" > <input type="checkbox" name="ids:list" value="file.id"> <a href="HOME_URL" tal:attributes="href python:container.getLink(file.id)" tal:content="file/id"></a> </tr> When selecting a file that must be deleted I receive the following error. Traceback (innermost last): a.. Module ZPublisher.Publish, line 98, in publish b.. Module ZPublisher.mapply, line 88, in mapply c.. Module ZPublisher.Publish, line 39, in call_object d.. Module OFS.DTMLMethod, line 126, in __call__ e.. Module DocumentTemplate.DT_String, line 474, in __call__ f.. Module DocumentTemplate.DT_Let, line 76, in render g.. Module DocumentTemplate.DT_With, line 76, in render h.. Module DocumentTemplate.DT_Try, line 140, in render i.. Module DocumentTemplate.DT_Try, line 149, in render_try_except j.. Module DocumentTemplate.DT_Util, line 201, in eval __traceback_info__: REQUEST k.. Module <string>, line 2, in f l.. Module Products.LocalFS.LocalFS, line 812, in manage_delObjects BadRequest: file.id does not exist What is wrong ? Regards. Michael
<tr tal:repeat="file batch" bordercolor="#0099FF" > <input type="checkbox" name="ids:list" value="file.id"> <a href="HOME_URL" tal:attributes="href python:container.getLink(file.id)" tal:content="file/id"></a> </tr>
When selecting a file that must be deleted I receive the following error. ... l.. Module Products.LocalFS.LocalFS, line 812, in manage_delObjects BadRequest: file.id does not exist
Unless you have a File called 'file.id' then Zope is right. Your form gives up the string 'file.id' for every time that checkbox is rendered, and manage_delObjects tried to delete it. You could see this clearly in the rendered HTML source, which is always a good sanity check. Use instead <tr tal:repeat="file batch" bordercolor="#0099FF" > <input type="checkbox" name="ids:list" value="dummyvalue" tal:attributes="value file/id"> <a href="HOME_URL" tal:attributes="href python:container.getLink(file.id)" tal:content="file/id"></a> </tr> Note also that using the 'getId' method is generally considered safer than the 'id' attribute. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
participants (2)
-
J Cameron Cooper -
Michael Bleijerveld