[Zope] Access denied when reading empty field in DB
Miller, John M.
jmiller1@uop.com
Wed, 2 Jun 1999 12:17:35 -0500
Yes Mr. Miller, there is a quite simple solution to your problem. Since I
am, in fact, you I know the DTML code you were using in your rendering
document:
<!--#in sql-method-->
... blah ... blah ...
<!--#var expr="_vars['Man Hours']"-->
... more blah ...
<!--#/in>
If you were to replace the above with something more like:
<!--#if name="_vars['Man Hours']"-->
<!--#var expr="_vars['Man Hours']"-->
<!--#/if-->
You would get much better results. Also, if you had been paying more
attention when you first wrote you would noticed your described problem was
with _all_ fields with empty values. My best guess (which is still rather
poor with my only basic understanding of Zope lore) is that the Z SQL method
won't create a variable representing a field in the database unless it
actually finds a value for that field. Or perhaps it could be something
completely different, I'm not really sure at the moment.
Have a pleasant day Mr. Miller,
John Miller
> -----Original Message-----
> From: Miller, John M. [SMTP:jmiller1@uop.com]
> Sent: Wednesday, June 02, 1999 9:09 AM
> To: 'zope@zope.org'
> Subject: [Zope] Access denied when reading empty field in DB
>
> 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 <string>, 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
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )