[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Zope Scripting

webmaster@zope.org webmaster@zope.org
Thu, 26 Sep 2002 17:27:29 -0400

A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/ScriptingZope.stx#3-25


      If the *updateInfo* script requires parameters, you must either
      choose a name for the DTML namespace binding (see Binding
      Variables below) so that the parameters will be looked up in the
      namespace, or you must pass the parameters in an expression,
      like this::

        <dtml-call expr="updateInfo(color='brown', pattern='spotted')">

        % Anonymous User - Sep. 4, 2002 12:34 pm:
         Calling a script with hardcoded values is pretty useless in the real world. It would be great to have an
         example that shows how to grab variables from the namespace and insert them into the parameter list in this

        % Anonymous User - Sep. 20, 2002 7:08 am:
         I'm not sure if the following snippet does the job:

         <dtml-call expr="updateInfo(color='<dtml-var hair_color>', pattern='<dtml-var hair_pattern>')">

        % Anonymous User - Sep. 26, 2002 5:27 pm:
         This does work:

         <dtml-var expr="make_user_list(users, abs_url)">
         <dtml-call expr="make_user_list(users, abs_url)">
         where users is a sql "dtml-in" call result parameter.
         abs_url was created like this:
         <dtml-set abs_url=absolute_url>

         in the above example, anything within the "" will be evaluated, so there is no need to specify "dtml-var".
         With sql calls this generally works:
         <dtml-in expr="some_sql_method(color=_['hair_color'], pattern=_['hair_pattern'])