[Zope] Access denied when reading empty field in DB

Miller, John M. jmiller1@uop.com
Wed, 2 Jun 1999 09:09:14 -0500


Hello,

I have a Z SQL method (querying through a Z ODBC connection to an Access
database) that retrieves all the entries in a particular row in a table in
my DB, as so:
	select *
	from [Verbal Requests]
	where [Case#] = <!--#sqlvar caseID type=int-->

Most of the time this works jolly well (I'm still getting over how easy this
was to set up in Zope after trying to use various wizards in Access,
*shudder* FrontPage, and *double shudder* Interdev) except when it encounter
a field with an empty value.  The field it chokes on contains values of type
Double.  I have specified no default value in the database setup.  The field
is named 'Man Hours' (so that you can recognize it in the traceback).

When a blank value is encountered the browser politely tells me "You are not
authorized to access this resource" and gives me the following traceback:

	Traceback (innermost last):
	  File C:\Program Files\ZopeEdge\lib\python\ZPublisher\Publish.py,
line 255, in publish_module
	  File C:\Program Files\ZopeEdge\lib\python\ZPublisher\Publish.py,
line 157, in publish
	  File C:\Program Files\ZopeEdge\lib\python\ZPublisher\mapply.py,
line 154, in mapply
	    (Object: index_html)
	  File C:\Program Files\ZopeEdge\lib\python\ZPublisher\Publish.py,
line 98, in call_object
	    (Object: index_html)
	  File C:\Program Files\ZopeEdge\lib\python\OFS\DTMLDocument.py,
line 181, in __call__
	    (Object: index_html)
	  File C:\Program Files\ZopeEdge\lib\python\OFS\DTMLDocument.py,
line 177, in __call__
	    (Object: index_html)
	  File C:\Program
Files\ZopeEdge\lib\python\DocumentTemplate\DT_String.py, line 514, in
__call__
	    (Object: index_html)
	  File /Program Files/ZopeEdge\lib\python\DocumentTemplate\DT_In.py,
line 675, in renderwob
	    (Object: get-vr-details)
	  File C:\Program
Files\ZopeEdge\lib\python\DocumentTemplate\DT_Util.py, line 315, in eval
	    (Object: _vars['Man Hours'])
	  File &lt;string&gt;, line 0, in ?
	  File C:\Program
Files\ZopeEdge\lib\python\DocumentTemplate\DT_Util.py, line 150, in
careful_getitem
	Unauthorized: (see above)

I am thinking this problem stems from having an empty (null?) value in this
field when it is expecting a floating-point value.  I imagine configuring
the Access database to provide a default value for this field will make this
go away.  Does anyone else have a better idea?  I did some thinking along
the lines of capturing this situation and providing a slightly more elegant
response, i.e. displaying all the fields expect the empty one, but my Zope
lore is woefully insufficient.

I am happy to provide any additional details that you so require,

Much thanks,
John Miller