On Fri, 3 Mar 2000, Chui Tey wrote:
Hi,
What is the difference between <dtml-call "...."> and <dtml-call ...>. For instance, if I have this directory structure:
[snip]
<dtml-call subfolder.manage_addFolder(...)> doesn't add any folders, while <dtml-call "subfolder.manage_addFolder(...)"> behaves as expected. It took about an hour of experimenting before getting this right. Could someone explain what is the difference here?
Calling tags with and without quotes follows mostly the same convention throughout Zope. A tag without quotes, such as: <dtml-var myMethod> is equivalent to: <dtml-var name=myMethod> This says, "Include the variable with the name myMethod." The alternate form is: <dtml-var "myMethod()"> which is equivalent to: <dtml-var expr="myMethod()"> This says, "Include the result of the Python expression in quotes, myMethod()." In your specific case, dtml-call without quotes is equivalent to using the name form, and thus does nothing. There is no attribute or method called subfolder.manage_addFolder(...). Note that Zope would be looking for this, literally, and would not interpret the period as an application of a method to an instance. Using the dtml-call tag with quotes is equivalent to the expr form, and will thus interpret the period appropriately. To convince yourself that this is the case, try including a DTML Method using the expr form without parenthesis: <dtml-var expr="myMethod"> puts this in the response: <function myMethod at 8071cf8> If you view this in a browser, you will not see it because your browser will try and interpret it as a <function ...> tag, which, of course, does not exist.
Thanks.
Hope this helps.
Chui
--Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
_______________________________________________ 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 )