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 6a29e94 Fix determination of the issue ID.
6a29e94 is described below
commit 6a29e94a9bdfa5be37fa19efb7a9ad8d391d9623
Author: Greg Stein <[email protected]>
AuthorDate: Sun Dec 22 06:51:20 2024 -0600
Fix determination of the issue ID.
The Issue ID is always the second segment of the path. Extract this
early, which fixes a bug for the "delete" action which tests ISSUE
before it (never) gets set.
(because action=="delete" fails, the ISSUE name is never tested;
basically, nobody has tried deleting an issue via the API)
---
pysteve/www/cgi-bin/rest_admin.py | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/pysteve/www/cgi-bin/rest_admin.py
b/pysteve/www/cgi-bin/rest_admin.py
index e38cc86..82a0d6a 100755
--- a/pysteve/www/cgi-bin/rest_admin.py
+++ b/pysteve/www/cgi-bin/rest_admin.py
@@ -64,6 +64,7 @@ else:
if re.search(r"([^A-Za-z0-9-.])", electionID):
response.respond(400, {'message': "Invalid election ID
supplied, must be [A-Za-z0-9-.]+"})
sys.exit(0) # BAIL!
+ issue = l[2] if len(l) > 2 else None
# List all existing/previous elections?
if action == "list":
@@ -118,7 +119,6 @@ else:
elif action == "create":
if karma >= 4: # karma of 4 required to set up an issue for the
election
if electionID:
- issue = l[2] if len(l) > 2 else None
if not issue:
response.respond(400, {'message': 'No issue ID
specified'})
elif re.search(r"([^A-Za-z0-9-.])", issue):
@@ -183,7 +183,6 @@ else:
elif action == "delete":
if karma >= 4: # karma of 4 required to set up an issue for the
election
if electionID:
- issue = l[2] if len(l) > 2 else None
if not issue:
response.respond(400, {'message': 'No issue ID
specified'})
else:
@@ -204,7 +203,6 @@ else:
# Edit an issue or election
elif action == "edit":
- issue = l[2] if len(l) > 2 else None
if (issue and karma >= 4) or (karma >= 5 and electionID):
if electionID:
if not issue:
@@ -402,7 +400,6 @@ else:
response.respond(404, {'message': 'No such election'})
# Tally an issue
elif action == "tally" and electionID:
- issue = l[2] if len(l) > 2 else None
if electionID and issue:
basedata = election.getBasedata(electionID)
# Allow access at all times to owners/admins, monitors after
closed
@@ -461,7 +458,6 @@ else:
# Get vote data
elif action == "monitor" and electionID:
- issue = l[2] if len(l) > 2 else None
if electionID and issue:
basedata = election.getBasedata(electionID, hideHash=True)
if karma >= 2 or ('owner' in basedata and basedata['owner'] ==
whoami):
@@ -494,7 +490,6 @@ else:
response.respond(404, {'message': 'No such election or
issue'})
# Vote backlog, including all recasts
elif action == "backlog" and electionID:
- issue = l[2] if len(l) > 2 else None
if electionID and issue:
basedata = election.getBasedata(electionID, hideHash=True)
if karma >= 2 or ('owner' in basedata and basedata['owner'] ==
whoami):