Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread onsombal
So, my script now works!! Thanks to everyone for your input. It is greatly appreciated. Below is a quick summary of what I did and a relevant excerpt of the working script. 1) I never was able to get passing the arguments via the context.Statement to work. I'm sure it's something I've done wr

Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Maciej Wisniowski
onsombal napisaƂ(a): > I tried the techniques you suggested and it results in the same error --> > "KeyError: 'form.submitted'" You didn't tell about this kind of error before. Post a full traceback, please. I suppose that error is somewhere else... -- Maciej Wisniowski __

Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Dieter Maurer
onsombal wrote at 2007-8-27 06:59 -0700: > ... > ... >It's easy to insert and update Z SQL Methods directly from form field >results. > >It's easy to read form field results (e.g. request.field2) and do >comparisons, etc. > >I am struggling to understand how one can change a form field result wit

Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Charlie Clark
Am 27.08.2007, 21:59 Uhr, schrieb onsombal <[EMAIL PROTECTED]>: I'm assuming the form results are stored as an object represented as a dictionary. If so, then there must be a way for my python script to change the key | value pair for field1 before I call my Z SQL Method. Is this reasonable

Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Charlie Clark
Am 27.08.2007, 15:59 Uhr, schrieb onsombal <[EMAIL PROTECTED]>: changed_field1 = form.get('field1') changed_field1 = "a new computed value" field1 = changed_field1 #create a new record with form field results for field2 & field3, and a computed value for field1 context.insertNew() ^

Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread onsombal
I tried the techniques you suggested and it results in the same error --> "KeyError: 'form.submitted'" field1 = changed_field1 context.insertNew(field1=field1) --> I also tried the other technique and got the same error. I tried your technique with the following changes to my pfg (ploneformgen)

Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Maciej Wisniowski
> changed_field1 = "a new computed value" > field1 = changed_field1 > > #create a new record with form field results for field2 & field3, and a > computed value for field1 > context.insertNew() Obvious things are sometimes hardest to find ;) Try: field1 = changed_field1 context.insertNew(field1=

[Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread onsombal
Here's the scenario: 1. "insertNew" is a Z SQL Method for creating a new record in pgsql "table1" Argument list = field1, field2, field3 SQL Query: INSERT INTO table1 (field1, field2, field3) VALUES ( , , ) 2. "call_insertNew" is a python script that is called as an "After Validati