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


The following commit(s) were added to refs/heads/trunk by this push:
     new a91c55d  add endpoint for issue support documents
a91c55d is described below

commit a91c55dc0fac2f680f6f3b063a289151b7ceaf2e
Author: Greg Stein <[email protected]>
AuthorDate: Thu Feb 26 12:48:16 2026 -0600

    add endpoint for issue support documents
---
 v3/server/pages.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/v3/server/pages.py b/v3/server/pages.py
index 0532589..2e82647 100644
--- a/v3/server/pages.py
+++ b/v3/server/pages.py
@@ -44,6 +44,7 @@ THIS_DIR = pathlib.Path(__file__).resolve().parent
 DB_FNAME = THIS_DIR / APP.cfg.db
 TEMPLATES = THIS_DIR / 'templates'
 STATICDIR = THIS_DIR / 'static'
+DOCSDIR = THIS_DIR / 'docs'
 
 # Formatted values to inject into templates.
 FMT_DATE = '%b %d'
@@ -636,6 +637,25 @@ async def about_page():
     return result
 
 
+# Serve supporting documents for an issue
[email protected]('/docs/<iid>/<docname>')
[email protected]  # fine-grained per-doc authz within the handler
+async def serve_doc(iid, docname):
+    result = await basic_info()  # get PID  ### grr: called uid
+
+    db = steve.election.Election.open_database(DB_FNAME)
+    row = db.q_get_mayvote.first_row(result.uid, iid)
+    if not row:
+        # Nothing fancy. Just pretend the file does not exist
+        quart.abort(404)
+        # NOTREACHED
+
+    ### verify the propriety of DOCNAME.
+
+    # Return per-issue document.
+    return await quart.send_from_directory(DOCSDIR / iid, docname)
+
+
 # Route to serve static files (CSS and JS)
 @APP.get('/static/<path:filename>')
 async def serve_static(filename):

Reply via email to