AW: [Zope] Understanding dtml and/or its variables

Bartakovic, Damir Damir.Bartakovic@Dresdner-Bank.com
Thu, 22 Feb 2001 08:24:38 +0100


Thanks Dieter,

exactly what I was searching for!

> Damir Bartakovic writes:
>  > I am using ZnolkSQLWizard and it creates output like
>  > <INPUT TYPE="TEXT" NAME="table.name"> ...
>  > 
>  > Now I am trying to force the user not to leave the field blank.
>  > Usually it works with <dtml-unless "somevariable"> ...  once again!
>  > ....</dtml-unless>
>  > 
>  > but with <dtml-unless "table.name">  ... I get the error:
>  > Error Type: NameError
>  > Error Value: table (The Traceback is at the end)
>  > 
>  > Like it seems it don't like the '.'?
> It likes '.' but interprets it differently:
> 
>   Inside "...", you are in the realm of Python expressions.
>   In Python, the "." is not part of a name (as in DTML)
>   but it is an operator: the left operand is an object,
>   the right one a name and the result is the object's attribute
>   of the given name.
> 
>   You can use, e.g. "_['table.name']" to access the object
>   with name "table.name" from Python.
> 
> The official Zope book and
> 
>     URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
> 
> will tell you more about these issues.