[Zope] Error trapping Duplicate entry in a database

larrymcdonnell at att.net larrymcdonnell at att.net
Thu Feb 15 10:24:04 EST 2007


Hi,

Thanks for the response, can you point me to some examples of python code that will handle this situation.


Sorry for th html...

Thanks,

Larry
 -------------- Original message ----------------------
From: "Jonathan" <dev101 at magma.ca>
> It would be much easier (and preferable) to handle the data processing 
> activities in python (a script or external method) and just use DTML to 
> display the results.  You could easily handle the looping, testing in python 
> and then just return 'success' or 'failure' which your DTML method could 
> test for and then display an appropriate message to the user.
> 
> 
> Jonathan
> 
> P.S.  please don't post in HTML...
> 
> 
> 
> ----- Original Message ----- 
> From: larrymcdonnell at att.net
> To: zope at zope.org
> Sent: Thursday, February 15, 2007 9:34 AM
> Subject: Re: [Zope] Error trapping Duplicate entry in a database
> 
> 
> 
> 
> -------------- Original message from larrymcdonnell at att.net: -------------- 
> 
> 
> Hi,
> 
> Thanks for the pointers but how can I trap for the first error. I am 
> populating a list and if the user makes a mistake and uses the wrong 
> application. I want to display only one message and the link to the correct 
> application.
> 
> With this code the message is repeated for each entry.
> 
> <dtml-call "REQUEST.set('student_score1', 
> student_score1_temp[loop_counter])">
> <dtml-try>
>         <dtml-call expr="create_holistic_score_record(REQUEST)">
> <dtml-except IntegrityError>
> <dtml-call "REQUEST.set('dup_rec', 'dup')">
> <dtml-if expr="dup_rec=='dup'">
> This class already exist in the database - Please use Update
> </dtml-if>
> </dtml-try>
> 
> This class already exist in the database - Please use Update
> This class already exist in the database - Please use Update ...
> 
> I just want to stop it after the first error.
> 
> Thanks in advance,
> 
> Larry
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev ) 
> 




More information about the Zope mailing list