RE: [Zope] server error with optional args to Z SQL method
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.
Rob Page writes:
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
[...]
Try taking the type declarations off:
link_num parent
Thanks for the tip - no type declarations obviously fools Zope into passing nothing and the conversion to an integer is done in the sqltest tag. Tim. -- Tim Potter, System Admin/Programmer "Disco Stu doesn't advertise" Advanced Computational Systems CRC, RSISE Bldg Australian National University, Canberra 0200, AUSTRALIA Ph: +61 2 62798813 Fax: +61 2 62798602
participants (2)
-
Rob Page -
Tim Potter