elections/admin.py elections/api.py elections/controllers.py
by Nigel Jones
elections/admin.py | 109 +++++++++++++++++++++++++++++++++++++++++++++++
elections/api.py | 109 -----------------------------------------------
elections/controllers.py | 2
3 files changed, 110 insertions(+), 110 deletions(-)
New commits:
commit e87f80def1a70f938d0abdf1e5a9a495a74b2ece
Author: Nigel Jones <nigjones(a)nigjones.csb>
Date: Sun Apr 5 09:48:31 2009 +1000
Just a tiny change
diff --git a/elections/admin.py b/elections/admin.py
new file mode 100644
index 0000000..04de30c
--- /dev/null
+++ b/elections/admin.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright © 2008 Nigel Jones, Toshio Kuratomi, Ricky Zhou, Luca Foppiano All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the GNU
+# General Public License v.2. This program is distributed in the hope that it
+# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
+# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details. You should have
+# received a copy of the GNU General Public License along with this program;
+# if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
+# Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks that are
+# incorporated in the source code or documentation are not subject to the GNU
+# General Public License and may only be used or replicated with the express
+# permission of Red Hat, Inc.
+#
+# Author(s): Nigel Jones <nigelj(a)fedoraproject.org>
+# Toshio Kuratomi <toshio(a)fedoraproject.org>
+# Ricky Zhou <ricky(a)fedoraproject.org>
+# Luca Foppiano <lfoppiano(a)fedoraproject.org>
+#
+# Report Bugs to https://www.fedorahosted.org/elections
+
+
+# Admin functions go here (i.e. add/delete elections)
+
+import turbogears
+from turbogears import controllers, expose, flash, redirect, config
+from turbogears import identity
+from elections import model
+from elections.model import Elections, ElectionsTable, Candidates, LegalVoters
+
+from fedora.tg.json import SABase
+from datetime import datetime
+
+import sqlalchemy
+
+from turbogears.database import session
+
+class Admin(controllers.Controller):
+ def __init__(self, fas, appTitle):
+ self.fas = fas
+ self.appTitle = appTitle
+
+ @expose(allow_json=True)
+ def list_elections(self, **kw):
+ electlist = Elections.query.order_by(ElectionsTable.c.start_date).filter('id>0').all()
+ elections = [{'id': e.id, 'alias': e.alias, 'shortdesc': e.shortdesc, 'start_date': e.start_date, 'end_date': e.end_date, 'legal_voters': [{'groupname': lv.group_name} for lv in LegalVoters.query.filter_by(election_id=e.id)]} for e in electlist]
+ return dict(elections=elections, servertime=datetime.utcnow(), appTitle=self.appTitle)
+
+ #@expose(template='elections.templates.adminlist')
+ @identity.require(identity.in_group("elections"))
+ @expose()
+ def index(self, **kw):
+ return "Hi"
+
+ @identity.require(identity.in_group("elections"))
+ @expose(template="elections.templates.admnewe")
+ def newe(self, **kw):
+ if "submit" in kw:
+ setembargo=1
+ setnominations=1
+ nominationend=0
+ usefas=1
+ if "embargoed" not in kw:
+ setembargo=0
+ if "allownominations" not in kw:
+ setnominations=0
+ if "nominationend" in kw:
+ nominationend=kw['nominationend']
+ if "usefas" not in kw:
+ usefas=0
+
+ Elections(alias=kw['alias'], status=0, method=0, shortdesc=kw['shortdesc'], description=kw['info'], url=kw['url'], start_date=kw['startdate'], end_date=kw['enddate'], embargoed=setembargo, seats_elected=kw['seats'], allow_nominations=setnominations, nomination_end=nominationend,usefas=usefas)
+ raise turbogears.redirect("/")
+ else:
+ return dict()
+
+ @identity.require(identity.in_group("elections"))
+ @expose(template="elections.templates.admnewc")
+ def newc(self, **kw):
+ if "submit" in kw:
+ for entry in kw['nameurl'].split("|"):
+ candidate = entry.split("!")
+ #Python doesn't have a good way of doing case/switch statements
+ if len(candidate) == 1:
+ Candidates(election_id=kw['id'],name=candidate[0], status=0, human=1)
+ elif len(candidate) == 2:
+ Candidates(election_id=kw['id'],name=candidate[0],url=candidate[1], status=0, human=1)
+ else:
+ turbogears.flash("There was an issue!")
+ raise turbogears.redirect("/admin/newc")
+ else:
+ return dict()
+
+ #@expose(template="elections.templates.admedit")
+ #def edit(self,eid=None):
+ # try:
+ # election = Elections.query.filter_by(id=int(eid)).all()[0]
+ # except ValueError:
+ # election = Elections.query.filter_by(shortname=eid).all()[0]
+ # election = Elections.query.filter_by(id=int(eid)).all()[0]
+ # candidates = Candidates.query.filter_by(election_id=eid).all()
+ # return dict(e=election, candidates=candidates)
+
+ #@expose()
+ #def save(self, **kw):
+ # return "Hi"
diff --git a/elections/api.py b/elections/api.py
deleted file mode 100644
index ac62b2c..0000000
--- a/elections/api.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright © 2008 Nigel Jones, Toshio Kuratomi, Ricky Zhou, Luca Foppiano All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2. This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details. You should have
-# received a copy of the GNU General Public License along with this program;
-# if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
-# Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks that are
-# incorporated in the source code or documentation are not subject to the GNU
-# General Public License and may only be used or replicated with the express
-# permission of Red Hat, Inc.
-#
-# Author(s): Nigel Jones <nigelj(a)fedoraproject.org>
-# Toshio Kuratomi <toshio(a)fedoraproject.org>
-# Ricky Zhou <ricky(a)fedoraproject.org>
-# Luca Foppiano <lfoppiano(a)fedoraproject.org>
-#
-# Report Bugs to https://www.fedorahosted.org/elections
-
-
-# Admin functions go here (i.e. add/delete elections)
-
-import turbogears
-from turbogears import controllers, expose, flash, redirect, config
-from turbogears import identity
-from elections import model
-from elections.model import Elections, ElectionsTable, Candidates, LegalVoters
-
-from fedora.tg.json import SABase
-from datetime import datetime
-
-import sqlalchemy
-
-from turbogears.database import session
-
-class Api(controllers.Controller):
- def __init__(self, fas, appTitle):
- self.fas = fas
- self.appTitle = appTitle
-
- @expose(allow_json=True)
- def list_elections(self, **kw):
- electlist = Elections.query.order_by(ElectionsTable.c.start_date).filter('id>0').all()
- elections = [{'id': e.id, 'alias': e.alias, 'shortdesc': e.shortdesc, 'start_date': e.start_date, 'end_date': e.end_date, 'legal_voters': [{'groupname': lv.group_name} for lv in LegalVoters.query.filter_by(election_id=e.id)]} for e in electlist]
- return dict(elections=elections, servertime=datetime.utcnow(), appTitle=self.appTitle)
-
- #@expose(template='elections.templates.adminlist')
- @identity.require(identity.in_group("elections"))
- @expose()
- def index(self, **kw):
- return "Hi"
-
- @identity.require(identity.in_group("elections"))
- @expose(template="elections.templates.admnewe")
- def newe(self, **kw):
- if "submit" in kw:
- setembargo=1
- setnominations=1
- nominationend=0
- usefas=1
- if "embargoed" not in kw:
- setembargo=0
- if "allownominations" not in kw:
- setnominations=0
- if "nominationend" in kw:
- nominationend=kw['nominationend']
- if "usefas" not in kw:
- usefas=0
-
- Elections(alias=kw['alias'], status=0, method=0, shortdesc=kw['shortdesc'], description=kw['info'], url=kw['url'], start_date=kw['startdate'], end_date=kw['enddate'], embargoed=setembargo, seats_elected=kw['seats'], allow_nominations=setnominations, nomination_end=nominationend,usefas=usefas)
- raise turbogears.redirect("/")
- else:
- return dict()
-
- @identity.require(identity.in_group("elections"))
- @expose(template="elections.templates.admnewc")
- def newc(self, **kw):
- if "submit" in kw:
- for entry in kw['nameurl'].split("|"):
- candidate = entry.split("!")
- #Python doesn't have a good way of doing case/switch statements
- if len(candidate) == 1:
- Candidates(election_id=kw['id'],name=candidate[0], status=0, human=1)
- elif len(candidate) == 2:
- Candidates(election_id=kw['id'],name=candidate[0],url=candidate[1], status=0, human=1)
- else:
- turbogears.flash("There was an issue!")
- raise turbogears.redirect("/admin/newc")
- else:
- return dict()
-
- #@expose(template="elections.templates.admedit")
- #def edit(self,eid=None):
- # try:
- # election = Elections.query.filter_by(id=int(eid)).all()[0]
- # except ValueError:
- # election = Elections.query.filter_by(shortname=eid).all()[0]
- # election = Elections.query.filter_by(id=int(eid)).all()[0]
- # candidates = Candidates.query.filter_by(election_id=eid).all()
- # return dict(e=election, candidates=candidates)
-
- #@expose()
- #def save(self, **kw):
- # return "Hi"
diff --git a/elections/controllers.py b/elections/controllers.py
index f4c1a9c..360def0 100644
--- a/elections/controllers.py
+++ b/elections/controllers.py
@@ -31,7 +31,7 @@ from cherrypy import request, response
from fedora.client.fas2 import AccountSystem
from elections import model
from elections.model import *
-from elections.api import Api
+from elections.admin import Admin
from elections.vote import Vote
import sqlalchemy
15 years, 1 month
elections.sql
by Nigel Jones
elections.sql | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
New commits:
commit 6a869e47dfc207a00b60d0e5172fad9b5919a0bc
Author: Nigel Jones <nigjones(a)njones.bne.redhat.com>
Date: Sat Apr 4 21:32:37 2009 +1000
Commit minor edits to SQL
diff --git a/elections.sql b/elections.sql
index 0d4ec4e..7f1a6c9 100644
--- a/elections.sql
+++ b/elections.sql
@@ -21,16 +21,17 @@ description text NOT NULL,
url text,
start_date timestamp DEFAULT 0 NOT NULL,
end_date timestamp DEFAULT 0 NOT NULL,
--- Are results currently embargoed?
-embargoed boolean NOT NULL,
-- Number of seats elected
seats_elected integer NOT NULL,
+-- Number of voters (filled post election)
+
+
-- Does this election support nominations?
-allow_nominations boolean NOT NULL,
+-- allow_nominations boolean NOT NULL,
-- If so, when do they have to be in by?
-nomination_end timestamp DEFAULT 0,
+-- nomination_end timestamp DEFAULT 0,
-- Do we use FAS for candidate names?
-usefas boolean NOT NULL,
+-- usefas boolean NOT NULL,
UNIQUE (alias),
PRIMARY KEY (id)
) ENGINE=InnoDB;
15 years, 1 month
Can Shee Have Multiple Orgasms?
by Casiano Minyard
Do you want to be seen as a captain oof the bedroom? Do you want your woman
to be RAVING to her friends about the great sex she has whhile all of them
get normal boring sex? Well if you do, then you definitely need too ...
<http://cid-12c9122606293708.spaces.live.com/blog/cns!12C9122606293708!104...>
And that in terms of high admiration, to the courage other
side. They jerked at it, stout and furious, particularly
foolish, and behold that foolish my lord, said malcolm but
added in haste, 'cept they be not yet one canonically, thanks
to your.
15 years, 1 month
Can She Have MMultiple Orgasms?
by Mose Nisbet
Do you want to bbe seen as a captain of the bedroom? Do you want your woman
to be RAVING to her friends about the great sex shhe has while all of them
get normal booring sex? Well if you do, then you definitely need to ...
<http://cid-df48f9c150f2f4ca.spaces.live.com/blog/cns!DF48F9C150F2F4CA!104...>
Collars of a side, bone the hinder leg, or else to drive
them, and take the team home. It was once, with no less
a mogul that sir gaheris himself as it seem'd, had done't.
their hands and faces he clung to this domain whose last
hour had come..
15 years, 1 month