[Zope] Cookies

Marcus Collins mcollins@sunesi.com
Thu, 25 May 2000 16:55:04 +0200


> -----Original Message-----
> From: Mabe, Brad [mailto:BRADLEY.D.MABE@saic.com]
> Sent: 25 May 2000 16:29
> To: 'zope@zope.org'
> Subject: [Zope] Cookies
> 
> I am trying to create a cookie based on the value returned from a sql
> method.  The following code fails with an invalid syntax error.
> 
> <dtml-in SQL_get_cntry>
>   <dtml-call "RESPONSE.setCookie('country_cookie', <dtml-var cntry_cd>)">
> <dtml-in>

Hi,

Inside quotation marks, you're writing python, so <dtml-var cntry_cd> makes
the parser barf. cntry_cd is pushed onto the namespace by the <dtml-in>, so
you can simply use:

<dtml-in SQL_get_cntry>
  <dtml-call "RESPONSE.setCookie('country_cookie', cntry_cd)">
</dtml-in>

Note also the slash in the closing </dtml-in>.

hth,

-- Marcus