[Zope] ZPT can't find file id in from form

J Cameron Cooper jccooper at jcameroncooper.com
Fri Aug 15 14:47:33 EDT 2003


>
>
><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."





More information about the Zope mailing list