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 3f167e66b3bb1413cb5236a9e24b928b07dd9255
Author: Greg Stein <[email protected]>
AuthorDate: Tue Oct 7 18:22:17 2025 -0500

    Add endpoints to open/close an Election.
---
 v3/server/pages.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/v3/server/pages.py b/v3/server/pages.py
index 9369bbf..5bf3702 100644
--- a/v3/server/pages.py
+++ b/v3/server/pages.py
@@ -201,6 +201,43 @@ async def manage_page(election):
     return result
 
 
[email protected]('/do-open/<eid>')
[email protected]({R.committer})  ### need general solution
+@load_election
+async def do_open_endpoint(election):
+    result = await signin_info()
+
+    ### check authz
+
+    _LOGGER.info(f'Opening election[E:{election.eid}]')
+
+    ### should open/keep a PersonDB instance in the APP
+    pdb = steve.persondb.PersonDB(DB_FNAME)
+
+    # Open the Election.
+    election.open(pdb)
+
+    # Return to the management page for this Election.
+    return quart.redirect(f'/manage/{election.eid}')
+
+
[email protected]('/do-close/<eid>')
[email protected]({R.committer})  ### need general solution
+@load_election
+async def do_close_endpoint(election):
+    result = await signin_info()
+
+    ### check authz
+
+    _LOGGER.info(f'Closing election[E:{election.eid}]')
+
+    # Close the Election.
+    election.close()
+
+    # Return to the management page for this Election.
+    return quart.redirect(f'/manage/{election.eid}')
+
+
 @APP.get('/profile')
 @asfquart.auth.require  # Bare decorator means just require a valid session
 @APP.use_template(TEMPLATES / 'profile.ezt')

Reply via email to