[Zope] Variable as record type or dictionary

Juan Carlos Coruņa jcoruna@umd.es
Mon, 3 Apr 2000 11:11:44 +0200


Hi Tino and Zopist,

Maybe me example was not the best. I will try to expose a better example:
(The real case is too complicated to expose here.)

Suppose:

"OrderHeader" is a insert ZSQL method:

insert into OrderHeader
  order_num,paymethod,client_num,client_name,client_address,... (over 40
columns)
values
  (<dtml-sqlvar order_num type=string>, copy the column "order_num" in a
variable
  <dtml-in "getPaymethods(code='TR')">
    <dtml-sqlvar paymethod type=string>, copy the column "paymethod" in a
variable
    ...
  </dtml-in>
  <dtml-in getClient(client_num='SD4998')">
    <dtml-sqlvar client_num type=string>, copy the column "client_num"
    <dtml-sqlvar client_name type=string>, copy the column "Client_name"
    ...
  </dtml-in>
  ...)
Each column to insert is obtained by a diferent ZSQL methods, REQUEST
variable or External Method.
----
"OrderLine" is a insert ZSQL method:

insert into OrderLine

(order_num,paymethod,client_num,client_name,client_address,...,product_num,.
.. (over 40 columns))
values
  (insert the column "order_num" from the variable,
   insert the column "client_num" from the variable,
   insert the column "client_name" from the variable,
   insert the column "client_address" from the variable,
   ...,
   <dtml-sqlvar product_num type=string>,
   ...)
----
Registering the order lines...
<dtml-call "OrderHeader(order_num='OR4567')">
<dtml-call "OrderLine(product_num='PENCIL-0067')">
<dtml-call "OrderLine(product_num='PEN-BLUE-8')">
<dtml-call "OrderLine(product_num='PENCIL-0045')">
<dtml-call "OrderLine(product_num='PENCIL-0023')">
<dtml-call "OrderLine(product_num='PEN-BLCK-1')">
<dtml-call "OrderLine(product_num='PEN-031')">
----
I don't like to put:

<dtml-call "getOrderHeader(order_num='OR4567')">

after the line <dtml-call "OrderHeader... because I think its superfluous as
I processed all the columns in
a previous method.

Storing each column in a REQUEST variable its a mess, I have a lot of
REQUEST variables and the variable name of them
can match some column names, so I can't mix the variables.

The best solution were a python dictionary type variable, or variables in a
diferent namespace,...

Any Ideas?

Juan Carlos Coruņa.