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 2015/03/22 18:55:10 UTC
svn commit: r1668426 - /steve/trunk/pytest/www/cgi-bin/rest_admin.py
Author: humbedooh
Date: Sun Mar 22 17:55:10 2015
New Revision: 1668426
URL: http://svn.apache.org/r1668426
Log:
also try JSON first on creating issues
Modified:
steve/trunk/pytest/www/cgi-bin/rest_admin.py
Modified: steve/trunk/pytest/www/cgi-bin/rest_admin.py
URL: http://svn.apache.org/viewvc/steve/trunk/pytest/www/cgi-bin/rest_admin.py?rev=1668426&r1=1668425&r2=1668426&view=diff
==============================================================================
--- steve/trunk/pytest/www/cgi-bin/rest_admin.py (original)
+++ steve/trunk/pytest/www/cgi-bin/rest_admin.py Sun Mar 22 17:55:10 2015
@@ -145,9 +145,22 @@ else:
raise Exception('Invalid vote type: %s' % form.getvalue('type'))
with open(issuepath + ".json", "w") as f:
candidates = []
+ c = []
+ s = []
if form.getvalue('candidates'):
- for name in form.getvalue('candidates').split("\n"):
- candidates.append({'name': name.strip()})
+ try:
+ c = json.loads(form.getvalue('candidates'))
+ if form.getvalue('statements'):
+ try:
+ s = json.loads(form.getvalue('statements'))
+ except:
+ s = form.getvalue('statements').split("\n")
+ except:
+ c = form.getvalue('candidates').split("\n")
+ z = 0
+ for entry in c:
+ candidates.append({'name': entry.strip(), 'statement': s[z] if len(s) > z else ""})
+ z += 1
f.write(json.dumps({
'title': form.getvalue('title'),
'description': form.getvalue('description'),