[Zope] Z SQL insert statements running twice?
Chris Cioffi
zope@stopthesanity.org
Tue, 25 Sep 2001 18:20:44 -0400
Here's my sql statment:
insert into stsWaitLinks
(userid, linkid, ldelete, wcatid, wurl, wtitle, wdescription)
values (1, 0, 0,
<dtml-sqlvar lcatid type="int">,
<dtml-sqlvar lurl type="string">,
<dtml-sqlvar ltitle type="string">,
<dtml-sqlvar ldescription type="string">)
Here's the DTML method that calls the above statement:
<dtml-var links_menu>
<div class="title"><dtml-var title_or_id></div>
<dtml-call "add_waiting_link(lcatid=wcategory, lurl=wurl, ltitle=wtitle,
ldescription=wdescription)">
<table border="0" cellpadding="3" cellspacing="0">
<tr><td align="right"><span class="form_q">Title:</span></td>
<td><span class="form_a"><dtml-var wtitle></span></td></tr>
<tr><td align="right"><span class="form_q">Description:</span></td>
<td><span class="form_a"><dtml-var wdescription></span></td></tr>
<tr><td align="right"><span class="form_q">URL:</span></td>
<td><span class="form_a"><dtml-var wurl></span></td></tr>
<tr><td align="right"><span class="form_q">Category:</span></td>
<dtml-in "category_name(catid=wcategory)">
<td><span class="form_a"><dtml-var category></span></td></tr>
</dtml-in>
</table>
<!-- end of DTML Method -->
the variables wcategory, wurl, wtitle, wdescription come from a form that
calls the above script. The form method is 'put'.
This is just one example, the same problem occurs with all SQL insert
statements on all other pages. It also happens when called from Python
scripts. (I prefer to use Python scripts to make data validation easier.)
Running the SQL statement in test mode gives the expected results, however,
running the command from within the dtml method causes a double entry into
the database.
On my site I'm using the site layout method described in
http://www.zope.org/Members/march/howtos/OnlyOneIndexHtml.
I'm using Zope v2.3.3, Python 1.5.2 and MySQL 3.23.31 on a Mandrake 7.2 box.
As always thanks for any clues.
Chris