[Zope] problem with REQUEST.set

Brian Lloyd Brian@digicool.com
Thu, 5 Aug 1999 11:44:02 -0400


> hey everyone,
> 
> i am having BIG problems using REQUEST.set within Zope. I am trying to
> dynamically build a URL to redirect the browser to using the following
> code:
> 
> <!--#call "REQUEST.set('jumpToBase', 
> '../foodirectory/index.html?member
> Num=' + userID)"-->
> <!--#call "RESPONSE.redirect('jumpToBase')"-->
> 
> but this is throwing back an error on the REQUEST.set part, the error
> looks as follows:
> 
> Object: REQUEST.set('jumpToBase', 
> '../foodirectory/index.html?memberNum
> =' + userDetails))
> File <string>, line 0, in ?
> TypeError: (see above)
> 
> The userDetails variable is a INT value pulled from a database and i
> cannot understand why it is falling over on this!!
> 
> Does anyone have any thoughts?

You can't use the '+' operator to concatenate different
types (a string and an int, in your case). Try:

<!--#call "REQUEST.set('jumpToBase', 
           '../foodirectory/index.html?memberNum=' + _.str(userID)
           )"-->

or even:

<!--#call "REQUEST.set('jumpToBase', 
           '../foodirectory/index.html?memberNum=%s' % userID
           )"-->

Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com