[Zope] server error with optional args to Z SQL method

Rob Page rob.page@digicool.com
Fri, 6 Aug 1999 09:21:34 -0400


> Just one more question for today.  (-:
> 
> I'm trying to create some optional arguments in Zope 2.0.0b1 to a Z
> SQL method using the sqlgroup and sqltest tags.  My query is
> 
> select * from links
> <!--#sqlgroup where-->
>   <!--#sqltest link_num type=int optional-->
> <!--#or-->
>   <!--#sqltest parent type=int optional-->
> <!--#/sqlgroup-->
> 
> and I've given it arguments of
> 
> link_num:int parent:int

Try taking the type declarations off:

link_num parent

if that doesn't do it give the arguments default blank values.  They'll
be type converted in the SQL:

link_num="" parent=""
 
> There doesn't seem to be a way to make the arguments optional (or at
> least ignore empty values) as if I change and test this query, leaving
> one of the arguments empty, I get an 'Error response Error code 500.
> Message: Internal Server Error' from Zope, and the following error on
> the xterm which started up Zope
> 
> 1999-08-06T07:21:50 ERROR(200) ZServer Server Error: 
> exceptions.ValueError, Empty entry when 
> <strong>integer</strong> expected: file: 
> /scratch/zope/Zope-2.0.0b1-linux2-x86/lib/python/ZPublisher/Co
> nverters.py line: 124
> 
> It's pretty obvious that Zope thinks I should have supplied a value
> for another parameter, but I think the fact it causes an exception is
> a bug.