From 1ecc3db3830bcedb1be5094988a5cc4abf6d5c62 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 8 Apr 2018 19:30:57 +0100 Subject: [PATCH] Remove packages with no approved releases from JSON --- app/views/packages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/packages.py b/app/views/packages.py index 8165c157..64283390 100644 --- a/app/views/packages.py +++ b/app/views/packages.py @@ -28,7 +28,9 @@ def doPackageList(type): query = query.filter(Package.title.contains(search)) if shouldReturnJson(): - return jsonify([package.getAsDictionary(app.config["BASE_URL"]) for package in query.all()]) + pkgs = [package.getAsDictionary(app.config["BASE_URL"]) \ + for package in query.all() if package.getDownloadRelease() is not None] + return jsonify(pkgs) else: tags = Tag.query.all() return render_template("packages/list.html", title=title, packages=query.all(), query=search, tags=tags, type=None if type is None else type.toName())