[Zope] Sequences and SQL

Michel Pelletier michel@digicool.com
Tue, 20 Jul 1999 12:06:50 -0400


> -----Original Message-----
> From: Sean McMains [mailto:smcmains@nortelnetworks.com]
> Sent: Tuesday, July 20, 1999 11:57 AM
> To: 'zope@zope.org'
> Subject: [Zope] Sequences and SQL
> 
> 
> Ok, now that I can get data into a database, I'm working on 
> getting it out
> again. A simple table works fine, but I'd like to add alternate-line
> shading. This is what I'm trying:
> 
> <!--#in getData-->
> <!--#if "sequence-even"-->
> ...

It's those quotes again, man.  This time you *don't* need them.

Quotes cause Zope to *evaluate* a Python expression.  In this case,
'sequence-even' looks to Python like 'sequence minus even'.

What you want is just <!--#if sequence-even-->.  Or, if you want to
access that value in an expression, try <!--#if "_['sequence-even']"-->.
The '_' namespace can act like a mapping to all of these DTML variables
that are illegal in python expressions.

-Michel

> shaded line code
> ...
> <!--#else-->
> ...
> unshaded line code
> ...
> <!--#/if-->
> 
> I can submit this to Zope no problem, but when I go to view 
> the page, I get
> the standard error message with this in the source:
> 
> <!--
>  Error type:  
>  Error value: sequence
>  -->
> 
> The error is generated by the line with the IF statement, as 
> I've verified
> by changing to to test a different expression. I expect that 
> I'm bumping
> into something syntactical, but can't figure out how to fix 
> it! Help from
> you more experienced Zopers is appreciated.
> 
> Thanks,
> Sean McMains
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>