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

onsombal onsombal at yahoo.com
Mon Aug 27 15:59:41 EDT 2007


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)
for and Z SQL Method:
1. with field1, field2, field3 all included in the pfg (ploneformgen) form
2. with these same three fields excluded from the pfg form
3. with my Z SQL method argument as field1
4. with my Z SQL method argument as field1=field1

I just know that there has to be an easy solution to this problem.

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, or am I just going down a rat-hole?

Thanks... Jim







Maciej Wisniowski wrote:
> 
>> 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=field1)
> 
> or even:
> 
> context.insertNew(field1='something', field2=other_variable)
> 
> It is more clear than getting values from context I think.
> 
> -- 
> Maciej Wisniowski
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db
> 
> 

-- 
View this message in context: http://www.nabble.com/updating-fields-in-a-zsql-method-programmatically-tf4335404.html#a12356504
Sent from the Zope - DB mailing list archive at Nabble.com.



More information about the Zope-DB mailing list