Author: nigelj
Date: 2008-06-06 10:48:00 +0000 (Fri, 06 Jun 2008)
New Revision: 44
Modified:
branches/0.1.0-STABLE/elections/controllers.py
branches/0.1.0-STABLE/elections/release.py
branches/0.1.0-STABLE/elections/templates/index.html
branches/0.1.0-STABLE/elections/templates/results.html
Log:
Merge r43 to 0.1.0-STABLE & bump release.py (we are getting closer)
Modified: branches/0.1.0-STABLE/elections/controllers.py
===================================================================
--- branches/0.1.0-STABLE/elections/controllers.py 2008-06-05 12:00:43 UTC (rev 43)
+++ branches/0.1.0-STABLE/elections/controllers.py 2008-06-06 10:48:00 UTC (rev 44)
@@ -52,11 +52,12 @@
eid = int(eid)
election = Elections.query.filter_by(id=eid).all()[0]
except ValueError:
- election = Elections.query.filter_by(shortname=eid).all()[0]
- eid = election.id
- except TypeError:
- turbogears.flash("This election does not exist, check if you have used the correct URL.")
- raise turbogears.redirect("/")
+ try:
+ election = Elections.query.filter_by(shortname=eid).all()[0]
+ eid = election.id
+ except IndexError:
+ turbogears.flash("This election does not exist, check if you have used the correct URL.")
+ raise turbogears.redirect("/")
except IndexError:
turbogears.flash("This election does not exist, check if you have used the correct URL.")
raise turbogears.redirect("/")
@@ -76,11 +77,12 @@
eid = int(eid)
election = Elections.query.filter_by(id=eid).all()[0]
except ValueError:
- election = Elections.query.filter_by(shortname=eid).all()[0]
- eid = election.id
- except TypeError:
- turbogears.flash("This election does not exist, check if you have used the correct URL.")
- raise turbogears.redirect("/")
+ try:
+ election = Elections.query.filter_by(shortname=eid).all()[0]
+ eid = election.id
+ except IndexError:
+ turbogears.flash("This election does not exist, check if you have used the correct URL.")
+ raise turbogears.redirect("/")
except IndexError:
turbogears.flash("This election does not exist, check if you have used the correct URL.")
raise turbogears.redirect("/")
@@ -89,7 +91,7 @@
match = 0
for group in votergroups:
- if identity.in_group(group.group_name):
+ if identity.in_group(group.group_name) or group.group_name == "anyany":
match = 1
if match == 0:
turbogears.flash("You are not in a FAS group that can vote in this election, more information can be found here.")
@@ -126,7 +128,7 @@
turbogears.flash("Invalid Ballot!")
raise turbogears.redirect("/")
for uvote in uvotes:
- Votes(voter=turbogears.identity.current.user_name, candidate_id=uvote, weight=uvotes[uvote], election_id=eid)
+ Votes(voter=turbogears.identity.current.user_name, candidate_id=uvote, weight=uvotes[uvote], election_id=eid, timestamp=curtime)
turbogears.flash("You vote has been recorded, thank you!")
raise turbogears.redirect("/")
elif "vote" in kw:
@@ -167,11 +169,12 @@
eid = int(eid)
election = Elections.query.filter_by(id=eid).all()[0]
except ValueError:
- election = Elections.query.filter_by(shortname=eid).all()[0]
- eid = election.id
- except TypeError:
- turbogears.flash("This election does not exist, check if you have used the correct URL.")
- raise turbogears.redirect("/")
+ try:
+ election = Elections.query.filter_by(shortname=eid).all()[0]
+ eid = election.id
+ except IndexError:
+ turbogears.flash("This election does not exist, check if you have used the correct URL.")
+ raise turbogears.redirect("/")
except IndexError:
turbogears.flash("This election does not exist, check if you have used the correct URL.")
raise turbogears.redirect("/")
Modified: branches/0.1.0-STABLE/elections/release.py
===================================================================
--- branches/0.1.0-STABLE/elections/release.py 2008-06-05 12:00:43 UTC (rev 43)
+++ branches/0.1.0-STABLE/elections/release.py 2008-06-06 10:48:00 UTC (rev 44)
@@ -24,7 +24,7 @@
# Release information about elections
-version = "0.0.5"
+version = "0.0.9.1"
description = "Elections Application for Fedora Project"
# long_description = "More description about your plan"
Modified: branches/0.1.0-STABLE/elections/templates/index.html
===================================================================
--- branches/0.1.0-STABLE/elections/templates/index.html 2008-06-05 12:00:43 UTC (rev 43)
+++ branches/0.1.0-STABLE/elections/templates/index.html 2008-06-06 10:48:00 UTC (rev 44)
@@ -7,10 +7,21 @@
<title>${appTitle}</title>
</head>
<body>
- <ul>
-<!-- !Maybe change this link depending if they are logged in or not -->
- <li py:for="election in elections"><a href="${tg.url('/about/' + election.shortname)}">${election.name}</a></li>
-<!-- !Would be nice features also include voting dates -->
- </ul>
+ <table>
+ <tr>
+ <th></th>
+ <th>Start Date (UTC)</th>
+ <th>End Date (UTC)</th>
+ <th></th>
+ <th></th>
+ </tr>
+ <tr py:for="election in elections">
+ <td>${election.name}</td>
+ <td>${election.start_date}</td>
+ <td>${election.end_date}</td>
+ <td><a href="${tg.url('/about/' + str(election.shortname))}">More Information</a></td>
+ <td><a py:if="election.public_results or curtime > election.end_date" href="${tg.url('/results/' + str(election.shortname))}">Results</a></td>
+ </tr>
+ </table>
</body>
</html>
Modified: branches/0.1.0-STABLE/elections/templates/results.html
===================================================================
--- branches/0.1.0-STABLE/elections/templates/results.html 2008-06-05 12:00:43 UTC (rev 43)
+++ branches/0.1.0-STABLE/elections/templates/results.html 2008-06-06 10:48:00 UTC (rev 44)
@@ -9,7 +9,7 @@
<body>
<h1>${election.name} Results</h1>
<p>${election.info}</p>
- <p py:if="candidate.url"><a href="${election.url}">[More Information]</a></p>
+ <p py:if="election.url"><a href="${election.url}">[More Information]</a></p>
<table border="1" cellpadding="1">
<tr py:for="candcount in votecount">
<td>${candcount.candidate.name} <small py:if="candcount.candidate.url"><a href="${candcount.candidate.url}">[info]</a></small></td>