python scripts,zsql methods and many parameters
I am beginning to experiment with python scripts and can't seem to find any code examples to do the specific operation I'm trying. To be specific, I want to insert a record into a database by calling a zsql method and passing it 8 individual parameters. Can anyone explain what exactly I'm missing. # my values are all in local variables # a = 'acme widgets' b = 'jet pack' c = '99.99' d = '07-15-2002' e = 'blue' f = '90 day' # I got an error leading me to believe that I can only list 5 parameters. # Is this syntax correct? # insert_object = container.logging_row_insert(company=a,item=b,cost=c,date=d,color=e,warranty =f) return
Jeff Sacksteder writes:
# I got an error leading me to believe that I can only list 5 parameters. You have been mislead. You can pass any (okay almost) number of parameters.
# Is this syntax correct? Almost.
Probably, your mail agent split the line after "=". If not, the syntax were wrong. It lacks a "\" at the end of this line (indication a continuation).
insert_object = container.logging_row_insert(company=a,item=b,cost=c,date=d,color=e,warranty =f)
return This value-less return is dangerous (more precisely, misleading). Zope will return an empty page. Many browsers do not want to believe this and wait indefinitely for something more, in vain...
Use instead something like: "return 'finished'" Dieter
participants (2)
-
Dieter Maurer -
Jeff Sacksteder