You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by hu...@apache.org on 2016/02/11 11:07:50 UTC

svn commit: r1729789 - /steve/trunk/pysteve/www/cgi-bin/rest_admin.py

Author: humbedooh
Date: Thu Feb 11 10:07:50 2016
New Revision: 1729789

URL: http://svn.apache.org/viewvc?rev=1729789&view=rev
Log:
- fix baseurl in json
- allow monitors access to final tally after election has closed (they've seen the raw data anyway).
- send tally URL to monitors upon closing.

Modified:
    steve/trunk/pysteve/www/cgi-bin/rest_admin.py

Modified: steve/trunk/pysteve/www/cgi-bin/rest_admin.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/www/cgi-bin/rest_admin.py?rev=1729789&r1=1729788&r2=1729789&view=diff
==============================================================================
--- steve/trunk/pysteve/www/cgi-bin/rest_admin.py (original)
+++ steve/trunk/pysteve/www/cgi-bin/rest_admin.py Thu Feb 11 10:07:50 2016
@@ -303,7 +303,7 @@ else:
                         response.respond(500, {'message': 'Could not load base data: %s' % err})
                     if 'hash' in basedata:
                         del basedata['hash']
-                    response.respond(200, {'base_data': basedata, 'issues': js, 'baseurl': "https://%s/steve/election.html?%s" % (config.get("general", "rooturl"), electionID)})
+                    response.respond(200, {'base_data': basedata, 'issues': js, 'baseurl': "%s/election.html?%s" % (config.get("general", "rooturl"), electionID)})
                 else:
                     response.respond(404, {'message': 'No such election: %s' % electionID})
             else:
@@ -405,7 +405,9 @@ else:
             issue = l[2] if len(l) > 2 else None
             if electionID and issue:
                 basedata = election.getBasedata(electionID)
-                if karma >= 4 or ('owner' in basedata and basedata['owner'] == whoami):
+                # Allow access at all times to owners/admins, monitors after closed
+                if karma >= 4 or ('owner' in basedata and basedata['owner'] == whoami) or \
+                (karma >= 2 and 'open' in basedata and basedata['open'] == False):
                     issuedata = election.getIssue(electionID, issue)
                     votes = election.getVotes(electionID, issue)
                     if issuedata and votes:
@@ -438,8 +440,9 @@ else:
                             response.respond(200, {'message': "Election reopened"})
                         else:
                             ehash, debug = election.getHash(electionID)
+                            murl =  "%s/admin/tally.html?%s" % (config.get("general", "rooturl"), electionID)
                             for email in basedata['monitors']:
-                                voter.email(email, "Monitoring update for election #%s: Election closed!" % electionID, debug)
+                                voter.email(email, "Monitoring update for election #%s: Election closed!" % electionID, "%s\n\nFinal tally available at: %s" % (debug, murl))
                             response.respond(200, {'message': "Election closed"})
                     except Exception as err:
                         response.respond(500, {'message': "Could not close election: %s" % err})