[Zope] Error handling in zope/ ext method calling a sproc to insert data into sql db?

Alisa K alisa2k@yahoo.com
Wed, 15 Jan 2003 12:13:44 -0800 (PST)


I'm working on adding detailed error handling to an
existing zope web application.  The web application (a
series of web pages served by zope) includes an html
form that inserts inputted data (and data in hidden
fields) into a sql database.  The form currently
submits the data to a dtml document that uses a Z SQL
method to do the insert <dtml-in
expr="zsql_nameofmethod(param1=1,param2=2, etc...). 
The Z SQL method, zsql_nameofmethod, is actually a
simple stored procedure call (exec storedprocedurename
).
  
Currently there is no error handling and all
submissions seem to "go through," even when the sproc
insert fails.  Thus, I need to add custom
error_handling to display an appropriate error message
to the front-end user when the sproc call fails to
insert.
I've searched the web for any kind of help but have
not found much to go on.  A simple
<dtml-try><dtml-except> block doesn't catch any error
from the sproc.

In the past I've taken the sproc call out of zope and
put it into an external method (python).  I've gotten
more detailed  error handling to work successfully
from the external method by raising a RuntimeError and
formatting what I get from sys.exc_info().  However,
is there a better way to handle errors with
zope/python/sql databases from within zope rather than
in external methods?

running Zope 2.5.1 (Python 2.1.3) on Win2k connecting
to SQL database.  External methods connected to
database using
win32com.client.Dispatch('ADODB.Connection')...

Alisa

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com