hi all, I have a folder hierarchy like: issue/1994/01 02 03 ... issue/1999/11 where I use numbers for the folder names, which seems natural here. When I want to acces this objects with <dtml-with "issue.1998.01"> I get the following error: -------------------------------------------------------------- Expression (Python) Syntax error: invalid syntax , for tag <dtml-with "issue.1998.01">, on line 9 of ... -------------------------------------------------------------- of course something like <dtml-with "issue.test"> works without a problem. I would change the names if I could, but 1999, 2000 are difficult to rename :-) Any hint? (after a short holiday whitouht Zope I seem to have forgotten everything.. :-)) <dtml-with "_.getitem('issue.1998.01')"> <dtml-with "_['issue.1998.01']"> do not work either, but I will need something in that direction, because "issue.1998.01",.. are just names which will come from an input form. hope this is a fool's question, otherwise I'm in big trouble... -- Tom http://www.linux-magazin.de/
At 19:42 08/09/99 , Tom Schwaller wrote:
hi all,
I have a folder hierarchy like:
issue/1994/01 02 03 ... issue/1999/11
where I use numbers for the folder names, which seems natural here. When I want to acces this objects with
<dtml-with "issue.1998.01">
I get the following error:
-------------------------------------------------------------- Expression (Python) Syntax error:
invalid syntax
, for tag <dtml-with "issue.1998.01">, on line 9 of ... --------------------------------------------------------------
of course something like
<dtml-with "issue.test">
works without a problem. I would change the names if I could, but 1999, 2000 are difficult to rename :-)
Any hint? (after a short holiday whitouht Zope I seem to have forgotten everything.. :-))
<dtml-with "_.getitem('issue.1998.01')"> <dtml-with "_['issue.1998.01']">
do not work either, but I will need something in that direction, because "issue.1998.01",.. are just names which will come from an input form.
Sound like the 1999.01 part is first parsed as a number. This might actually be a bug. Try <dtml-with "issue.1998"><dtml-with 01> If this doesn't work, rename the folders to something including a letter, like m01 or i01 (for month and issue respectively) -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Try: <dtml-with issue><dtml-with 1998><dtml-with 01> ... </dtml-with></dtml-with></dtml-with> At 09:52 AM 9/9/99 +0200, Martijn Pieters wrote:
At 19:42 08/09/99 , Tom Schwaller wrote:
hi all,
I have a folder hierarchy like:
issue/1994/01 02 03 ... issue/1999/11
where I use numbers for the folder names, which seems natural here. When I want to acces this objects with
<dtml-with "issue.1998.01">
I get the following error:
-------------------------------------------------------------- Expression (Python) Syntax error:
invalid syntax
, for tag <dtml-with "issue.1998.01">, on line 9 of ... --------------------------------------------------------------
"Phillip J. Eby" wrote:
Try:
<dtml-with issue><dtml-with 1998><dtml-with 01> ... </dtml-with></dtml-with></dtml-with>
yes! This works. I'm just back from the Linux-Kongress (aka my personal Zope-2.0 promotion tour, I wish I had a Zope T-Shirt :-)) and happy to see a solution for my problem. "Michel Pelletier" wrote
Numbers are not valid python names.
ok. Nevertheless you can use numbers as folder names, which was the reason I got into trouble...
You can, however, use getattr:
<dtml-with "_.getattr(_.getattr(issue, '1998'), '01')">
I like this one :-)
or:
<dtml-with issue> <dtml-with 1998> <dtml-with 01> ...
DTML tags arguments used 'by name' and not in an expression can access illegal python names (because it uses getattr). ;)
that's fine. Thanks a lot to all for the help.. -- Tom
participants (3)
-
Martijn Pieters -
Phillip J. Eby -
Tom Schwaller