Author: humbedooh
Date: Mon Mar 23 09:16:49 2015
New Revision: 1668566
URL: http://svn.apache.org/r1668566
Log:
move vote types to a lib
Added:
steve/trunk/pysteve/www/cgi-bin/lib/constants.py
Modified:
steve/trunk/pysteve/www/cgi-bin/rest_admin.py
Added: steve/trunk/pysteve/www/cgi-bin/lib/constants.py
URL:
http://svn.apache.org/viewvc/steve/trunk/pysteve/www/cgi-bin/lib/constants.py?rev=1668566&view=auto
==============================================================================
--- steve/trunk/pysteve/www/cgi-bin/lib/constants.py (added)
+++ steve/trunk/pysteve/www/cgi-bin/lib/constants.py Mon Mar 23 09:16:49 2015
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+VALID_VOTE_TYPES =
['yna','stv1','stv2','stv3','stv4','stv5','stv6','stv7','stv8','stv9']
\ No newline at end of file
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=1668566&r1=1668565&r2=1668566&view=diff
==============================================================================
--- steve/trunk/pysteve/www/cgi-bin/rest_admin.py (original)
+++ steve/trunk/pysteve/www/cgi-bin/rest_admin.py Mon Mar 23 09:16:49 2015
@@ -43,7 +43,7 @@ pathinfo = os.environ['PATH_INFO'] if 'P
whoami = os.environ['REMOTE_USER'] if 'REMOTE_USER' in os.environ else None
-from lib import response, voter, election, form
+from lib import response, voter, election, form, constants
if not whoami:
response.respond(403, {'message': 'Could not verify your identity: No auth
scheme found'})
@@ -149,8 +149,7 @@ else:
raise Exception("Required fields
missing: %s" % ", ".join(xr))
else:
xr.pop(0)
- valid_types =
['yna','stv1','stv2','stv3','stv4','stv5','stv6','stv7','stv8','stv9']
- if not form.getvalue('type') in valid_types:
+ if not form.getvalue('type') in
constants.VALID_VOTE_TYPES:
raise Exception('Invalid vote type: %s' %
form.getvalue('type'))
with open(issuepath + ".json", "w") as f:
candidates = []