[Zope] about with

Casey Duncan cduncan@kaivo.com
Thu, 22 Mar 2001 07:45:47 -0700


Sven wrote:
> 
> hi to everybody
> 
> why does this wortk :
> 
> <dtml-with expr="x010314">
> 
> and not this :
> 
> <dtml-with expr="010314">
> 
> ???????? the quotes should prevent it from being treated as a number i guess
> ???
> 
> thanx
> 
> SVEN
> 

You have run into an unintuitive feature of dtml. That is that Quoted
attributes are treated as expressions unless you explicitly use the
name="..." syntax.

so your first example, expr="x010314" is treated as: The object named
x010314

Whereas the second example is treated as: The number 10314.

Both are expressions, but the top one cannot be evaluated as a Python
number, so it is treated as an object reference.

name="x010314" and name="010314" would both treat them as object
references as would expr="_['010314']" which all explicitly look for
objects by name.

You would also run into a similar problem if your object names contain
punctuation the is considered significant in Python such as a period,
space or dash.

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>