[extensions-web] extensions: Fix the case of trying to fetch an incompatible extension
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] extensions: Fix the case of trying to fetch an incompatible extension
- Date: Thu, 29 Mar 2012 23:33:46 +0000 (UTC)
commit c54bfd2b8ddea346bcbf47bcd7e0ecdf85e57355
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Mar 29 19:33:38 2012 -0400
extensions: Fix the case of trying to fetch an incompatible extension
404 instead of 500, because Django is super inconsistent :(
sweettooth/extensions/views.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 9559cae..fa9846d 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -60,10 +60,11 @@ def shell_download(request, uuid):
if not shell_versions:
raise Http404()
- try:
- version = extension.visible_versions.filter(shell_versions__in=shell_versions).order_by('-version')[0]
- except models.ExtensionVersion.DoesNotExist:
+ versions = extension.visible_versions.filter(shell_versions__in=shell_versions)
+ if versions.count() < 1:
raise Http404()
+ else:
+ version = versions.order_by('-version')[0]
extension.downloads += 1
extension.save(replace_metadata_json=False)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]