[Zope] simple DTML question ...

Peter Sabaini sabaini@niil.at
Fri, 28 Jan 2000 16:07:49 +0100 (CET)


On Fri, 28 Jan 2000, Darran Edmundson wrote:

:It's 12:30 am and I've been Zoping for 15 hours without
:a break.  I just ran into a problem that can be pared
:down to the following example ...
:
:Create a DTML method:
:
:  <dtml-var standard_html_header>
:  <dtml-var "foobar(year='chosen_year')">
:  <dtml-var standard_html_footer>
:
:and try to render it where foobar is another DTML method:
:
:  <input type=text name="<dtml-var year>:int"
:     value='<dtml-var "ZopeTime()" fmt="%Y">'>
:
:I suspect the source of my misunderstanding can be put
:in an even simpler example.  If foobar contains only
:<dtml-var "ZopeTime()"> then calling foobar via
:<dtml-var "foobar"> returns the unevaluated DTML.  Why
:is this?  I wandered through Amos' "Advanced DTML"
:How-To but I'm not thinking clearly.  I can probably
:figure it out tomorrow but I would dearly love to awake
:in the morning and find the source of my confusion
:awaiting in my Inbox.

hm, your last example can be solved by leaving out the ""'s (which
is equivalent to <dtml-var expr="foobar"> which doesn't render. 

for the above you could set the variable 'year' in the _ object, eg.:

<dtml-with "_.namespace(year='2010')">
<dtml-var foobar>
</dtml-with>

hth,

peter.

:
:Cheers,
:darran.
:
:
:Traceback follows:
:
:Traceback (innermost last):
:  File D:\Zope\ZopeSite1\lib\python\ZPublisher\Publish.py, line 214, in
:publish_module
:  File D:\Zope\ZopeSite1\lib\python\ZPublisher\Publish.py, line 179, in
:publish
:  File D:\Zope\ZopeSite1\lib\python\Zope\__init__.py, line 202, in
:zpublisher_exception_hook
:    (Object: ElementWithAttributes)
:  File D:\Zope\ZopeSite1\lib\python\ZPublisher\Publish.py, line 165, in
:publish
:  File D:\Zope\ZopeSite1\lib\python\ZPublisher\mapply.py, line 160, in
:mapply
:    (Object: t4)
:  File D:\Zope\ZopeSite1\lib\python\ZPublisher\Publish.py, line 102, in
:call_object
:    (Object: t4)
:  File D:\Zope\ZopeSite1\lib\python\OFS\DTMLMethod.py, line 145, in __call__
:    (Object: t4)
:  File D:\Zope\ZopeSite1\lib\python\DocumentTemplate\DT_String.py, line 502,
:in __call__
:    (Object: t4)
:  File D:\Zope\ZopeSite1\lib\python\DocumentTemplate\DT_Util.py, line 335,
:in eval
:    (Object: foobar(year='chosen_year'))
:    (Info: foobar)
:  File <string>, line 0, in ?
:  File D:\Zope\ZopeSite1\lib\python\OFS\DTMLMethod.py, line 141, in __call__
:    (Object: foobar)
:  File D:\Zope\ZopeSite1\lib\python\DocumentTemplate\DT_String.py, line 502,
:in __call__
:    (Object: foobar)
:  File D:\Zope\ZopeSite1\lib\python\DocumentTemplate\DT_Var.py, line 278, in
:render
:    (Object: ZopeTime())
:  File D:\Zope\ZopeSite1\lib\python\DocumentTemplate\DT_Util.py, line 335,
:in eval
:    (Object: ZopeTime())
:    (Info: ZopeTime)
:  File <string>, 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 )
:

-- 

_________________________________________________
peter sabaini, mailto: sabaini@niil.at
-------------------------------------------------