[Zope] meaning error message
Daryl Tester
dt@picknowl.com.au
Thu, 16 Mar 2000 09:54:24 +1030
Jonothan Farr wrote:
> I would solve this in the submit action by doing a select for the data
> before doing an insert.
[snip]
> <dtml-in select_data>
> <dtml-if sequence-start>
> <dtml-var error_message>
> </dtml-if>
> <dtml-else>
> <dtml-call insert_data>
> </dtml-in>
I see a couple of issues with this:
1) This may not scale well; if select_data becomes large you may
be spending a while in the dtml-in loop.
2) There could still be a race condition here, between the check for
data and the insertion (especially coupled with the above point - the
probability would increase proportionally with the load of the machine
and the size of the table). I say "could" here (guardedly :-), because
I don't know how Zope's transaction semantics are implemented, and how
they affect the DA that you're using (does anyone have any pointers to
documents? I've just started reading "How to Write a DA", and this
mentions the distributed commit protocol).
I'm not sure if a solution to the original problem is to surround
the insert with a <dtml-try> tag; I'm going to try this myself
sometime today (if I get some spare time :-).
> -jfarr
Regards,
Daryl Tester