[Zope] SQL Method running twice

Justin Dunsworth justin.dunsworth at gmail.com
Tue Dec 15 15:10:17 EST 2009


Let me take this a bit further and I hate spamming but if any other person
that has a similar issue can refer to...

I simplified a page and all it's dependencies and added code back one by
one. It eventually ended up coming down to one tag that was switching
browser modes and POSTed twice. Switched compatability mode to on with IE8
and did it with the same tag and it worked fine.

I removed the tag: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">



On Tue, Dec 15, 2009 at 1:09 PM, Justin Dunsworth <
justin.dunsworth at gmail.com> wrote:

> Investigating further the page is actually being posted twice. This was due
> to javascript and not the database, transactions, or otherwise.
>
> On Tue, Dec 15, 2009 at 11:50 AM, Andreas Jung <lists at zopyx.com> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Please re-read my answer.
>>
>> Andreas
>>
>> schrieb Justin Dunsworth:
>>  > This seems to be happening on more than just one query now... is
>> > there any suggestion on where to look?
>> >
>> > On Thu, Dec 10, 2009 at 1:14 PM, Justin Dunsworth <
>> > justin.dunsworth at gmail.com> wrote:
>> >
>> >> Thanks for the reply... Are you suggesting that there may be an
>> >> issue with MySQL receiving the data from zope and the way it
>> >> handles it?
>> >>
>> >> Strange thing is that I'm using the exact same method I have used
>> >> thousands of times over and same code layout and this is the
>> >> first time I'm seeing it. I've changed around a few things
>> >> relating to variable names etc thinking it was the case but
>> >> dumbing it down to the simplest way I can still is giving the
>> >> error.
>> >>
>> >> On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung <lists at zopyx.com>
>> >> wrote:
>> >>
>> >>> 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>&nbsp;&nbsp; <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
>> >>>
>> >>>
>> >>>
>> >
>> >
>> > ----------------------------------------------------------------------
>> >
>> >
>> >
>> _______________________________________________
>> > 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
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (Darwin)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAksnzGMACgkQCJIWIbr9KYwPlACg1ddItBhsM1dT10Iq9pE/ULgE
>> RwkAoOfg9NdwZKdvx9DqSWfK91X1myTh
>> =x0AL
>> -----END PGP SIGNATURE-----
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20091215/01257871/attachment.html 


More information about the Zope mailing list