GNOME Bugzilla – Bug 567041
Python: Allow setting via the record object
Last modified: 2010-02-25 18:52:32 UTC
I don't think we can set values using the same [] syntax that is available for getting values. We should make that possible. http://library.gnome.org/users/glom/unstable/sec-calculated-fields.html.de#field-values
Implemented with this commit. It's easier now that we are using boost::python. 2010-02-25 Murray Cumming <murrayc@murrayc.com> Python functions: Allow setting of values in the record via []. * glom/python_embed/python_module/py_glom_module.cc: Specify a setitem(), so python code can use [] syntax to set the record's field values as well as getting them. * glom/libglom/python_embed/py_glom_record.[h|cc]: PyGlomRecord_SetFields(): Take and store the primary key details and value, and use it in setitem() to UPDATE the value in the database. * glom/python_embed/glom_python.[h|cc]: glom_execute_python_function_implementation(), glom_evaluate_python_function_implementation(): Take the primary key field and value. * glom/base_db.cc: * glom/base_db_table_data.cc: * glom/mode_data/box_data.cc: * glom/mode_design/fields/dialog_fieldcalculation.cc: * glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc: Adapted.