views:

176

answers:

1

What is wrong with this Genshi template:

<html xmlns:py="http://genshi.edgewall.org/"&gt;     
  <head>
    <title py:content="title"></title>
  </head>
  <body>  
    <left>
    <table py: for="i in range(1, len(ctabl))">
        <li py: for="e in ctabl[i]">
            ${e}
        </li> 
    </table>
  </body>
</html>

I get this error:

genshi.template.base.TemplateSyntaxError: not well-formed (invalid token): line 7, column 14 (templates/index2.html, line 7)

Seems that there is something wrong with the table loop... I don't know.

+1  A: 

I've never used Genshi, but their list of allowed processing directives do not have any spaces between py, the :, and the for. Try removing that space. And anyway, Line 7, Column 14 is on the colon or the space, depending on whether you count from 0 or 1, right?

Mark Rushakoff
This is correct. The "py:" in "py:for" is part of the XML namespace, and comes from the 'xmlns:py="http://genshi.edgewall.org/"'. That declares the "XML namespace" ("xmlns") with "py" as a local abbreviation for "http://genshi.edgewall.org"
Andrew Dalke