Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 962e63ea3ecc6830d1b1a8e220ea8e6e9eb9c999
Author: Bohuslav Kabrda <bkabrda(a)redhat.com>
Date: Mon Jan 28 09:54:49 2013 +0100
Construct output as dictionary and use flask.jsonify for serialization
---------------------------------------------------------------
coprs_frontend/coprs/views/api_ns/api_general.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/coprs_frontend/coprs/views/api_ns/api_general.py
b/coprs_frontend/coprs/views/api_ns/api_general.py
index bbb8373..943a6ed 100644
--- a/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -89,18 +89,18 @@ def api_new_copr():
infos.append('Initial packages were successfully submitted '
'for building.')
- output = '{"output" : "ok", "message" :
"%s"}' % ("\n".join(infos))
+ output = {'output': 'ok', 'message' :
'\n'.join(infos)}
db.session.commit()
except exceptions.DuplicateCoprNameException, err:
- output = '{"output": "notok", "error":
"%s"}' % err
+ output = {'output': 'notok', 'error': err}
db.session.rollback()
else:
errormsg = "\n".join(form.errors['name'])
errormsg = errormsg.replace('"', "'")
- output = '{"output": "notok", "error":
"%s"}' % errormsg
+ output = {'output': 'notok', 'error': errormsg}
- return flask.Response(output, mimetype='application/json')
+ return flask.jsonify(output)
@api_ns.route('/owned/')