After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 567041 - Python: Allow setting via the record object
Python: Allow setting via the record object
Status: RESOLVED FIXED
Product: glom
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Murray Cumming
Murray Cumming
Depends on:
Blocks:
 
 
Reported: 2009-01-08 16:41 UTC by Murray Cumming
Modified: 2010-02-25 18:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Murray Cumming 2009-01-08 16:41: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
Comment 1 Murray Cumming 2010-02-25 18:52:32 UTC
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.