[albatross-users] complete newbie al-for / template problem....
Dave Cole
djc at object-craft.com.au
Fri Sep 13 17:03:29 EST 2002
gnb> I'm a complete newbie when it comes to albatross, but the
gnb> following script is giving errors I don't understand.
gnb>
gnb> s = '''
gnb> <table>
gnb> <al-for iter="f" expr = "flist">
gnb> <tr>
gnb> <al-for iter="f2" expr = "filenames(f)">
gnb> <td><al-value expr="f2"></td>
gnb> </al-for>
gnb> </tr>
gnb> </al-for>
gnb> </table>
gnb> '''
gnb>
gnb> import albatross
gnb> ctx = albatross.SimpleContext('.')
gnb> albatross.Template(ctx, '<magic>', s).to_html(ctx)
gnb> ctx.flush_content()
gnb>
gnb> Traceback (most recent call last):
gnb> File "t.py", line 15, in ?
gnb> albatross.Template(ctx, '<magic>', s).to_html(ctx)
gnb> File "/usr/local/lib/python2.1/site-packages/albatross/template.py", line 283, in __init__
gnb> raise TemplateError('%s:%s: "%s"; unexpected "%s" end tag' \
gnb> albatross.template.TemplateError: <magic>:7: "/al-for"; unexpected "al-for" end tag
gnb>
gnb> I've stared and stared at this, and compared it to the popview
gnb> example, and I'm stumped.
I think the spaces around the '=' in the <al-for ... expr = "...">
tags are causing the parser regexes to not recognise the tags. Things
which are not recognised by the regex are treated as plain text.
Try changing the template to this:
<table>
<al-for iter="f" expr="flist">
<tr>
<al-for iter="f2" expr="filenames(f)">
<td><al-value expr="f2"></td>
</al-for>
</tr>
</al-for>
</table>
- Dave
--
http://www.object-craft.com.au
More information about the Albatross-users
mailing list