[Zope] Understanding dtml and/or its variables

Tino Wildenhain tino@wildenhain.de
Thu, 22 Feb 2001 16:27:23 +0100


hi,

may be http://www.zope.org/Members/Zen/howto/FormVariableTypes
helps you to understand.
Basically the . is the delimiter for object/subobject relations
in python. In your case you get "name" either with <dtml-var "table.name">
or <dtml-with table> <dtml-if name> ... <dtml-else> ... </dtml-if name> 
</dtml-with>

HTH
Tino Wildenhain

--On Dienstag, 20. Februar 2001 18:18 +0100 Damir Bartakovic 
<db@konsylo.com> wrote:

> Hi all,
>
> 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 '.'?
>
> But for <dtml-var table.name> I'm getting the right value.
> So what I'm not understanding? How can I solve it and is it a good idea to
> use '.' in variables?
>
> Thanks
> Damir
>
>
> Traceback (innermost last):
>   File /usr/local/share/zope/lib/python/ZPublisher/Publish.py, line 222,
>   in publish_module
>   File /usr/local/share/zope/lib/python/ZPublisher/Publish.py, line 187,
>   in publish
>   File /usr/local/share/zope/lib/python/Zope/__init__.py, line 221, in
> zpublisher_exception_hook
>     (Object: Traversable)
>   File /usr/local/share/zope/lib/python/ZPublisher/Publish.py, line 171,
>   in publish
>   File /usr/local/share/zope/lib/python/ZPublisher/mapply.py, line 160, in
> mapply
>     (Object: html_insert)
>   File /usr/local/share/zope/lib/python/ZPublisher/Publish.py, line 112,
>   in call_object
>     (Object: html_insert)
>   File /usr/local/share/zope/lib/python/OFS/DTMLMethod.py, line 172, in
> __call__
>     (Object: html_insert)
>   File /usr/local/share/zope/lib/python/DocumentTemplate/DT_String.py,
>   line 528, in __call__
>     (Object: html_insert)
>   File /usr/local/share/zope/lib/python/DocumentTemplate/DT_Util.py, line
> 337, in eval
>     (Object: table.name)
>     (Info: table)
>   File &lt;string&gt;, line 0, in ?
> NameError: (see above)
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>