BackTalk to Document The Zope Book (2.6 Edition)/Relational Database Connectivity

[email protected]
Newsgroups gmane.comp.web.zope.zdp
Message-ID <[email protected]>
A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDatabases.stx#3-62

---------------

      If you call a Z SQL Method without argument from DTML, the arguments
      are automatically collected from the REQUEST. This is the technique 
      that we have used so far in this chapter. It works well when you want
      to query a database from a search form, but sometimes you want to 
      manually or programmatically query a database. Z SQL Methods can be
      called with explicit arguments from DTML or Python.  For example, to
      query the *employee_by_id* Z SQL Method manually, the following DTML
      can be used::

        <dtml-var standard_html_header>

          <dtml-in expr="employee_by_id(emp_id=42)">
            <h1><dtml-var last>, <dtml-var first></h1>

            <p><dtml-var first>'s employee id is <dtml-var emp_id>.  <dtml-var
            first> makes <dtml-var salary fmt=dollars-and-cents> per year.</p>
          </dtml-in>

        <dtml-var standard_html_footer>

        % Anonymous User - Nov. 25, 2003 12:13 pm:
         And how do you do it if you want to call it with a dtml-var as argument instead of a fix argument.

         I tried <dtml-in expr="employee_by_id(emp_id=<dtml-var bidule>)"> but it didn't work

        % Anonymous User - Jan. 8, 2004 1:02 pm:
         Just try <dtml-in expr="employee_by_id(emp_id=`bidule`)">
         I've spent 1 hour to find this *#%#2§!!!

        % Anonymous User - Jan. 9, 2004 9:25 am:
         or try <dtml-in expr="employee_by_id(emp_id=bidule)">

        % Anonymous User - Feb. 11, 2004 10:59 am:
         I tried <dtml-call expr="employee_by_id(emp_id=42)">
         <dtml-var last>

         But it doesnt work?  I figure from reading this that it should?

_______________________________________________
ZDP maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zdp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.