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

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

commit b24614953908228476ad4ed224b46d13a20afe23
Author: Greg Stein <[email protected]>
AuthorDate: Sun May 29 21:42:43 2022 -0500

    add methods to delete items
---
 v3/steve/election.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/v3/steve/election.py b/v3/steve/election.py
index e818a6f..ec94740 100644
--- a/v3/steve/election.py
+++ b/v3/steve/election.py
@@ -55,6 +55,10 @@ class Election:
                  name=excluded.name,
                  email=excluded.email
             ''')
+        self.c_delete_issue = self.db.add_statement(
+            'DELETE FROM ISSUES WHERE iid = ?')
+        self.c_delete_record = self.db.add_statement(
+            'DELETE FROM RECORD WHERE rid = ?')
 
         # Cursors for running queries.
         self.q_metadata = self.db.add_query('metadata',
@@ -158,6 +162,12 @@ class Election:
         # be touched (it should be NULL).
         self.c_add_issue.perform((iid, title, description, type, kv, None))
 
+    def delete_issue(self, iid):
+        "Delete the Issue designated by IID."
+        assert self.is_editable()
+
+        self.c_delete_issue.perform((iid,))
+
     def get_participant(self, rid):
         "Return NAME, EMAIL for Participant on record RID."
 
@@ -173,6 +183,12 @@ class Election:
         # be touched (it should be NULL).
         self.c_add_record.perform((rid, name, email, None))
 
+    def delete_participant(self, rid):
+        "Delete the Participant designated by RID."
+        assert self.is_editable()
+
+        self.c_delete_record.perform((rid,))
+
     def is_tampered(self):
 
         # The Election should be open.

Reply via email to