[Zope] wrong value for integer variable?

Martijn Pieters mj@antraciet.nl
Tue, 03 Aug 1999 15:33:52 +0200


At 19:57 28/07/99 , Donald Holten wrote:
>         I have the followin in my html page:
>
>         <!--#call "REQUEST.set('numtemp',GetRuns())"-->
>         <!dtml-call "manage_changeProperty(numtemp = numtemp + 1)">
>         <!--#call "update_AccessCounter()"-->
>
>         numtemp is an integer property of the html page.
>         When trying to run the ZSQL Method update_AccessCounter(), I get an
>error saying "Invalid integer value for numtemp".  Here is
>update_AccessCounter():
>
>         update WRTable
>           set numruns = <!--#sqlvar numtemp type=int-->
>
>
>         The possible cause for this that I can see is GetRuns() is not 
> returning
>an integer value.  If so, how can I force it to?  GetRuns currently is:
>
>         select numruns from WRTable
>
>         And numruns is declared an integer in WRTable.
>         If I am wrong, and GetRuns is sending back an integer, what is 
> causing
>this error?  Thanks!
>         Donner

A Z SQL Method returns a sequence, even if it only contains one element. So 
you are setting 'numtemp' to a contain a sequence, which is definitely not 
allowed. Change the code to:

  <!--#in GetRuns-->
     <!--#call "REQUEST.set('numtemp', numruns)"-->
  <!--#/in-->


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------