[Zope] DTML Call Fails
Tino Wildenhain
tino at wildenhain.de
Tue Oct 24 14:45:43 EDT 2006
hpinson at indepthl.com schrieb:
> Hi Tino. Yes, that is correct. This application has variables named
> like:
>
> 'AR-DA-08'
Not very clever.
> This also fails in a Page Template:
>
> <span tal:define="standards python: request.SESSION">
> <tal:block define="temp python: data.set('AR-DA-08',AR-DA-
> 08)"></tal:block>
you still have to quote if you mean the variable with that
weird name. Otherwise its an expression in python.
_['AR-DA-08'] could work in DTML... but lets better forget
that ;) Where does your variable live? In Request maybe?
> </span>
>
> With the error:
>
> Compilation failed
> TAL.TALDefs.TALError: Python expression error:
> invalid token (Python expression "data.set('AR-DA-08',AR-DA-08)",
> line 1) in expression "python: data.set('AR
TAL??
>
> Yet this works:
>
> <span tal:define="standards python: request.SESSION">
> <tal:block define="temp python: data.set('AR-DA-07',AR-DA-
> 07)"></tal:block>
> </span>
>
> So you are saying the interpreter is seeing the '-' as a minus? Why
> would it work in one case and not the other?
See Andrew's note on ocal numbers.
>
> Could the minus be escaped somehow?
No, but see above.
Could you please escape the horribly code + template
mixing with DTML? ;) See the zope book for python scripts.
(After all in DTML "expressions" its already python code,
so why not write just python code and skip all that
<foo> stuff around it you dont need anyway?
Regards
Tino Wildenhain
More information about the Zope
mailing list