[ZPT] (no subject)
Jim Greer
jgreer@viabridge.com
Wed, 9 Apr 2003 11:01:19 -0500
Greetings,
Disclaimer: I'm a recent ZPT convert. I seek the validation of one of
my observations and advice as to whether I am doing something 'the ZPT
way'.
I am constructing several dynamic forms using ZPT. Much of the dynamic
content in the form is database-driven; a have a set of ZSQLMethods that
provide the necessary set of values. These SQL queries require
parameters. In order to provide values to the query, I've had to do
something a bit odd, and I want to make sure I'm not needlessly
complicating things. An example:
1 <body
2 tal:define=
3 "l_collaboration here/collaboration;
4 q_clbr_id
python:here.get_collaboration_id_by_name(c_name=l_collaboration)[0];
5 l_clbr_id q_clbr_id/clbr_id;
[ I've provided line numbers for reference. ]
Three points about the above:
I) I've defined a new variable, l_collaboration, based on an acquired
value. I've done this because I couldn't get a direct use of the value
as a query parameter to work. That is, use of "here/collaboration"
instead of "l_collaboration" in line 4 did not work. Should this be?
II) In 4, I use [0] to get the first (and what should be only) member of
the rowset. I've seen this idiom referenced elsewhere on this list.
III) In 5, I extract the column of interest from the row.
Wordy? Yes. Sufficient? Apparently so. Necessary? You tell me.
Critique away,
Jim Greer