[extensions-web] adjust-popularity: Don't error out when given a bad extension uuid
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] adjust-popularity: Don't error out when given a bad extension uuid
- Date: Thu, 18 Jul 2013 17:17:00 +0000 (UTC)
commit 6808c43b2b5609b3cec80f909e2be46e9ca23488
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jul 18 13:16:39 2013 -0400
adjust-popularity: Don't error out when given a bad extension uuid
This can happen if testing an extension locally that isn't on the
website.
sweettooth/extensions/views.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index aec86c8..f0adb62 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -252,7 +252,11 @@ def ajax_adjust_popularity_view(request):
uuid = request.POST['uuid']
action = request.POST['action']
- extension = models.Extension.objects.visible().get(uuid=uuid)
+ try:
+ extension = models.Extension.objects.get(uuid=uuid)
+ except models.Extension.DoesNotExist:
+ raise Http404()
+
pop = models.ExtensionPopularityItem(extension=extension)
if action == 'enable':
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]