[Zope] SQL Method running twice
Andreas Jung
lists at zopyx.com
Thu Dec 10 14:03:58 EST 2009
In case of a ZODB conflict error the whole request will be repeat up to
three times.
If you database does not provide proper transaction support (trible
check your MySQL
installation and your table type useage), you're doomed. A proper RDBMS
like Oracle
or Postgres will behave properly and abort the transaction in case of a
ZODB transaction
abort.
-aj
Am 10.12.09 19:59, schrieb Justin Dunsworth:
> I am running into a brand new issue today that I can't, for the life
> of me, figure out. I wrote a standard page to insert data into a MySQL
> table using Z SQL methods from a form like I always have but for some
> strange reason it's running the same query twice, thus adding a
> duplicate entry.
>
> I have confined the original code in it's own document, checked,
> double checked, and still no avail. Here's the code for the page:
>
> <dtml-var frame_header>
> <dtml-if addnewstatus>
> <dtml-try>
> <dtml-call "RootSQLMethods.admin.Status_Add(_.None,_)">
> <dtml-call "RESPONSE.redirect(BASE2+'/statuses')">
> <dtml-except>
> <p>Error while submitting! Status not added.</p>
> <br>Error type: <dtml-var error_type>
> <br>Error value: <dtml-var error_value>
> </dtml-try>
> </dtml-if>
> <form action="&dtml-URL;" method="post">
> <table class="tborder" align="center" width="30%" cellspacing="0" >
> <tr><td class="tcat" align="center" colspan="2" style="font-size:
> 12pt;">Add New Status</td></tr>
> <tr><td width="35%" align="right"><b>Name:</b></td><td
> width="65%"><input type="text" name="name_add" size=15></td></tr>
> <tr><td width="35%" align="right"
> valign="top"><b>Description:</b></td><td width="65%"><textarea
> name="description_add" cols=25 rows=4></textarea></td></tr>
> <tr><td width="35%" align="right"><b>Sort:</b></td><td
> width="65%"><input type="text" name="sort_add" value="5" size=1></td></tr>
> <tr><td align="center" colspan="2"><hr></td></tr>
> <tr>
> <td><input type="hidden" name="addnewstatus" value="1"></td>
> <td>
> <button class="button" onclick="this.form.submit()">Add
> Status</button>
> <button class="button" onclick="window.location = '<dtml-var
> BASE2>/statuses'; return false;">Cancel</button>
> </td>
> </tr>
> </table>
> </form>
> <dtml-var frame_footer>
>
> I can run the SQL Method by itself and it works just fine (only
> inserting it once) but when run as a separate page it adds the two.
>
> Any assistance is appreciated
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> https://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> https://mail.zope.org/mailman/listinfo/zope-announce
> https://mail.zope.org/mailman/listinfo/zope-dev )
>
--
ZOPYX Ltd. & Co KG \ zopyx group
Charlottenstr. 37/1 \ The full-service network for your
D-72070 Tübingen \ Python, Zope and Plone projects
www.zopyx.com, info at zopyx.com \ www.zopyxgroup.com
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lists.vcf
Type: text/x-vcard
Size: 316 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20091210/62cbb6fc/attachment.vcf
More information about the Zope
mailing list