[Zope] Cannot determine exception cause

Doug Chamberlin DChamberlin@AndoverSoftware.com
Tue, 04 Jun 2002 14:47:53 -0400


Please help a fledgling Zope user who is trying to build his first Zope site!

I have a database in which there is a table of "activity groups" which can 
be obtained from the selectActivityGroups ZSQL. This works fine. The 
document which produces this page is ListGroups.

 From ListGroups I can click the Edit button to get toe the EditAGroup 
page. This also works fine and the selected record's values are transferred 
correctly. When I click the Save button, the UpdateAGroup document is 
accessed which, in turn, accesses the UpdateGroup ZSQL. When this is done 
an error occurs which causes the exception to be raised in UpdateAGroup.

1. How can I detect further what the cause of the exception is?
2. Why does the error message come out "Error while saving group _['dbid']" 
instead of translating the dbid value?

Document ListGroups:
<dtml-var standard_html_header>
<h2><dtml-var title_or_id></h2>
<p>
<table width="100%" border=2>
   <tr>
     <th>Activity Groups</th>
   </tr>
   <dtml-in "selectActivityGroups()">
     <tr>
       <td><dtml-var shortname></td>
       <td><dtml-var longname></td>
       <td><dtml-var description></td>
       <td><form>
             <input type="submit" name="EditAGroup:method" value="Edit"></td>
             <input type=hidden name="dbid" value="<dtml-var dbid>">
             <input type=hidden name="shortname" value="<dtml-var shortname>">
             <input type=hidden name="longname" value="<dtml-var longname>">
             <input type=hidden name="description" value="<dtml-var 
description>">
           </form>
       </td>
     </tr>
   </dtml-in>
</table>
</p>
<dtml-var standard_html_footer>

Document EditAGroup:
<dtml-var standard_html_header>
<h2><dtml-var title_or_id></h2>
<p>
<form action="." method=post>
<input type=hidden name="dbid" value="<dtml-var dbid>">
<input type=hidden name="shortname" value="<dtml-var shortname>">
<input type=hidden name="longname" value="<dtml-var longname>">
<input type=hidden name="description" value="<dtml-var description>">
<table width="100%">
<tr>
   <td><b>ID: </b></td>
   <td><dtml-var dbid></td>
</tr>

<tr>
   <td><b>Short Name: </b></td>
   <td><input type="text" name="newshortname" value="<dtml-var shortname>" 
size=32></td>
</tr>

<tr>
   <td><b>Long Name: </b></td>
   <td><input type="text" name="newlongname" value="<dtml-var longname>" 
size=64></td>
</tr>

<tr>
   <td><b>Description: </b></td>
   <td><input type="text" name="newdescription" value="<dtml-var 
description>" size=100></td>
</tr>

<tr>
   <td colspan=2><input type="submit" name="UpdateAGroup:method" 
value="Save"></td>
   <td colspan=2><input type="submit" name="ListGroups:method" 
value="Cancel"></td>
</tr>
</table>
</form>
</p>
<dtml-var standard_html_footer>

Document UpdateAGroup:
<dtml-var standard_html_header>
<dtml-try>
   <p>_['dbid']</p>
   <dtml-call "UpdateGroup(dbid=_['dbid'],
     NewShortName=_['newshortname'],
     NewLongName=_['newlongname'],
     NewDescription=_['newdescription'])">
   Group has been successfully updated!
   <form action="ListGroups" method=post>
     <input type="submit" value="OK">
   </form>
<dtml-except>
   Error while saving group _['dbid']. Canges were <b>not</b> saved.
   <form action="." method=post>
     <!-- TODO need to add all hidden fields here again...>
     <input type="submit" name="EditAGroup:method" value="Try Again">
     <input type="submit" name="ListGroups:method" value="Return to List">
     <input type=hidden name="dbid" value="<dtml-var dbid>">
     <input type=hidden name="shortname" value="<dtml-var newshortname>">
     <input type=hidden name="longname" value="<dtml-var newlongname>">
     <input type=hidden name="description" value="<dtml-var newdescription>">
   </form>
</dtml-try>
<dtml-var standard_html_footer>

ZSQL UpdateGroup (has params of dbid, NewShortName, NewLongName, 
NewDescription):
update GroupsOfActivities
set
   ShortName=<dtml-sqlvar NewShortName type=string>,
   LongName=<dtml-sqlvar NewLongName type=string>,
   Description=<dtml-sqlvar NewDescription type=string>
where
   DBID=<dtml-sqlvar dbid type=string>