[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Relational Database Connectivity
webmaster@zope.org
webmaster@zope.org
Tue, 01 Oct 2002 10:20:22 -0400
A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/RelationalDatabases.stx#3-68
---------------
If you call a Z SQL Method without argument from DTML, the
arguments are automatically collected from the
environment. 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 - Oct. 1, 2002 10:20 am:
"the arguments are automatically collected from the environment"
Need more details on how this automatic process works 'cos it trips a lot of people up. Doesn't it only
search the REQUEST, and even then only if it's passed as the first positional parameter to the method?