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 fc2e2bcd7a8986d8ffc15dee0be4568abb34acb2 Author: Greg Stein <[email protected]> AuthorDate: Mon May 30 20:57:37 2022 -0500 restrict usage of some methods --- v3/steve/election.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/v3/steve/election.py b/v3/steve/election.py index 130dc61..9e7b2c9 100644 --- a/v3/steve/election.py +++ b/v3/steve/election.py @@ -201,6 +201,9 @@ class Election: def add_vote(self, rid, iid, votestring): "Add VOTESTRING as the (latest) vote by RID for IID." + # The Election should be open. + assert self.is_open() + md = self.q_metadata.first_row() record = self.q_get_record.first_row((rid,)) issue = self.q_get_issue.first_row((iid,)) @@ -216,6 +219,11 @@ class Election: self.c_add_vote.perform((voter_token, issue_token, salt, token)) def gather_issue_votes(self, iid): + "Return a list of votestrings for a given ISSUE-ID." + + # The Election should be closed. + assert self.is_closed() + md = self.q_metadata.first_row() issue = self.q_get_issue.first_row((iid,)) issue_token = crypto.gen_token(md.opened_key, iid, issue.salt) @@ -237,6 +245,9 @@ class Election: def has_voted_upon(self, rid): "Return {ISSUE-ID: BOOL} stating what has been voted upon." + # The Election should be open. + assert self.is_open() + md = self.q_metadata.first_row() record = self.q_get_record.first_row((rid,)) voter_token = crypto.gen_token(md.opened_key, rid, record.salt)
