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 9048d3bd828273aab96368ecf538db5f0ea1586b Author: Greg Stein <[email protected]> AuthorDate: Sun Sep 28 13:23:34 2025 -0500 Beging some page content work, and authz. --- v3/server/pages.py | 27 +++++++++++++++++++++++++++ v3/server/templates/voter.ezt | 9 ++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/v3/server/pages.py b/v3/server/pages.py index d06ff41..757745e 100644 --- a/v3/server/pages.py +++ b/v3/server/pages.py @@ -15,10 +15,23 @@ # limitations under the License. # +import sys +import pathlib + +from easydict import EasyDict as edict +import asfpy.stopwatch import quart import asfquart +from asfquart.auth import Requirements as R + APP = asfquart.APP +THIS_DIR = pathlib.Path(__file__).resolve().parent +DB_FNAME = THIS_DIR / APP.cfg.db + +sys.path.insert(0, str(THIS_DIR.parent)) +import steve.election + @APP.get('/') @APP.use_template('templates/home.ezt') @@ -29,14 +42,25 @@ async def home_page(): @APP.get('/voter') [email protected]({R.committer}) @APP.use_template('templates/voter.ezt') async def voter_page(): + with asfpy.stopwatch.Stopwatch(): + election = steve.election.Election.open_to_pid(DB_FNAME, 'gstein') + owned = steve.election.Election.owned_elections(DB_FNAME, 'gstein') + + election = [ edict(eid='123', title='test election') ] + owned = [ edict(eid='456', title='another', authz=None, closed=None) ] + return { 'title': 'Voting', + 'election': election, + 'owned': owned, } @APP.get('/admin') [email protected]({R.committer}) @APP.use_template('templates/admin.ezt') async def admin_page(): return { @@ -45,6 +69,7 @@ async def admin_page(): @APP.get('/profile') [email protected] # Bare decorator means just require a valid session @APP.use_template('templates/profile.ezt') async def profile_page(): return { @@ -53,6 +78,7 @@ async def profile_page(): @APP.get('/settings') [email protected] # Bare decorator means just require a valid session @APP.use_template('templates/settings.ezt') async def settings_page(): return { @@ -61,6 +87,7 @@ async def settings_page(): @APP.get('/sign-out') [email protected] # Bare decorator means just require a valid session async def sign_out(): ### clear the cookie? return '', 204 diff --git a/v3/server/templates/voter.ezt b/v3/server/templates/voter.ezt index 4d95432..2fadefe 100644 --- a/v3/server/templates/voter.ezt +++ b/v3/server/templates/voter.ezt @@ -2,7 +2,14 @@ <div class="container"> <h1>[title]</h1> <p> - TBD + [for election] + [election.eid] [election.title] + [end] + </p> + <p> + [for owned] + [owned.eid] [owned.title] [owned.authz] [owned.closed] + [end] </p> </div> [include "footer.ezt"]
