This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8e3073f  Update sqlite.py, drop any non-sqlite-defined fields from 
document before updating it
8e3073f is described below

commit 8e3073f6911eeb34cdccbbaf0ae4625e9d50c2ec
Author: Daniel Gruno <[email protected]>
AuthorDate: Sat Feb 8 13:32:57 2025 +0100

    Update sqlite.py, drop any non-sqlite-defined fields from document before 
updating it
---
 pysteve/lib/backends/sqlite.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pysteve/lib/backends/sqlite.py b/pysteve/lib/backends/sqlite.py
index f03889b..cbc8fa9 100644
--- a/pysteve/lib/backends/sqlite.py
+++ b/pysteve/lib/backends/sqlite.py
@@ -184,6 +184,9 @@ class SQLiteBackend:
 
     def issue_update(self, electionID, issueID, issueData):
         "Update an issue with new data"
+        # Make a clean issue document that only has the sqlite-defined fields 
in it
+        issue_fields = ("id", "election", "title", "description", "type", 
"candidates", "seconds", "nominatedby")
+        new_data = {k:v for k,v in issueData.items() if k in issue_fields}
         self.DB.db.update("issues", issueData, id=issueID, election=electionID)
 
     def issue_list(self, election):

Reply via email to