[Zope] Re: survey: zope 2.7 syntax errors with TAL statments over multiple lines

Passin, Tom tpassin at mitretek.org
Wed Dec 31 15:24:20 EST 2003


[Evan Simpson ]

> Gerry Kirk wrote:
> > Any time a TAL statement extends over multiple lines, I get a syntax
> > error, like this one:
> > 
> > in expression "python:test( no_types == 1\r\n ,
> > 'Add New ' + types[0].Title()\r\n , 'Add New Item')"
> 
> I see a problem -- those '\r\n' shouldn't be there.  Python on Linux, 
> and ZPT, expect all lines to end with '\n'.  I'm not sure how 
> these are 
> slipping in, but I suspect that the cause is writing ZPT text using a 
> Windows tool.  We can fix this when reading from a file by 
> using the new 
> 'U' mode.
> 

ZPT is supposed to be using XML, and in XML, all new line characters get
converted to the equivalent of '\n', regardless of the OS.  SO this
needs to happen.

However, neither the attribute value nor Python would care if there were
line feeds in the example locations or not - as long as they were real
line feeds and not escape characters, anyway.

If the TAL expressions were truly XML, and one wanted line breaks, they
ought to read like this -

"python:test( no_types == 1
,
  'Add New ' + types[0].Title()
, 'Add New Item')"

Cheers,

Tom P



More information about the Zope mailing list