[Zope] calling a ZSQL method

Joachim Schmitz perry@ac-copy.net
Fri, 13 Aug 1999 09:24:25 +0200 (CEST)


Hello,

I trying to write a general purpose WEB-Form. To accomplish this I use a
TinyTable to hold the description of the form, i.e. which fields in which
order and so on should be displayed. The idea is to have such a TinyTable
for each table in a folder and one DTML-Document in the root folder, which
handles all the form-operations. This works for displaying the form. Now I
want (have) to take this one step further and want to make a general
ZSQLMethod to do forexample an INSERT so I created a ZSQLmethod named
insert with the following SQL-Template:

insert into <!--#var table sql_quote upper --> (
<!--#in EinAusgabe -->
<!--#unless sequence-start -->,<!--#/unless -->
<!--#var name -->
<!--#/in -->)
values
<!--#in EinAusgabe -->
<!--#unless sequence-start -->,<!--#/unless -->
<!--#var expr="_[name]" fmt=sql-quote-->"
<!--#/in -->)

there is only the argument table defined.

EinAusgabe is my TinyTable like this:

columns:
name label ftype length:int default auto

data:
"event_id", "Event-Nr", "int", 10,"", "max"
"art", "Event-Art", "string", 20, "kino", NULL
"veran_id", "Veranstalter-ID", "string", 8, NULL, NULL
"veran_ort", "Ort", "string", 40, NULL, NULL

when I now "call" insert in my DTML document like

<!--#with REQUEST -->
<!--#in insert -->
inserting <!--#var sequence-item -->
<!--#/in -->
<!--#/with -->
I get the following traceback: (snippet)

<!--
 Error type:  
 Error value: event_id
 -->

 File /u/src/Zope-1.10.3/lib/python/DocumentTemplate/DT_Util.py, line 266,
in eval
    (Object: _[name])
  File <string>, line 0, in ?
  File /u/src/Zope-1.10.3/lib/python/DocumentTemplate/DT_Util.py, line
150, in careful_getitem
KeyError: (see above)

If I put "event_id" on the argumentlist then I get    
<!--
 Error type:  
 Error value: argument 1: expected read-only character buffer, int found
 -->
So it seams that the arguments have to be listed. How can I do that in the
same way as in the SQL-template. Or is there another way to do it ?

Any tips are welcome.



Gruß

Joachim Schmitz

WWW-Consultant

email: js@ac-copy.net
tel: +49-241-89491-0
fax: +49-241-89491-29