Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit e34c61bee4b40b465fa466ec8a30c20623c0e547
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Apr 14 15:37:09 2014 +0200
check if chroot exist for specified project
addressing:
Exception on /api/coprs/hhorak/mysql55-test1/detail/fedora-20-x86_64/ [GET]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1687, in
wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1360, in
full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1358, in
full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1344, in
dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/share/copr/coprs_frontend/coprs/views/api_ns/api_general.py",
line 414, in copr_chroot_details
output = {'output': 'ok', 'buildroot_pkgs':
ch.buildroot_pkgs}
AttributeError: 'NoneType' object has no attribute 'buildroot_pkgs'
---------------------------------------------------------------
.../coprs/views/api_ns/api_general.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
index c5b43eb..b1acaee 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -411,8 +411,13 @@ def copr_chroot_details(username, coprname, chrootname):
httpcode = 500
else:
ch = copr.check_copr_chroot(chroot)
- output = {'output': 'ok', 'buildroot_pkgs':
ch.buildroot_pkgs}
- httpcode = 200
+ if ch:
+ output = {'output': 'ok', 'buildroot_pkgs':
ch.buildroot_pkgs}
+ httpcode = 200
+ else:
+ output = {"output": "notok", "error":
"Invalid chroot for this project."}
+ httpcode = 404
+
jsonout = flask.jsonify(output)
jsonout.status_code = httpcode