From 7ecd8eca2cf0bd786b6f8cd2bc89421d40ad651a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Wed, 30 Jan 2013 17:30:09 +0100 Subject: [PATCH] remove reference to IntegrityError --- mygpo/api/advanced/__init__.py | 5 ++--- mygpo/api/legacy.py | 6 +----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/mygpo/api/advanced/__init__.py b/mygpo/api/advanced/__init__.py index daff083f..fd7333c6 100644 --- a/mygpo/api/advanced/__init__.py +++ b/mygpo/api/advanced/__init__.py @@ -29,7 +29,6 @@ except ImportError: from django.http import HttpResponse, HttpResponseBadRequest, Http404, HttpResponseNotFound from django.contrib.sites.models import RequestSite -from django.db import IntegrityError from django.views.decorators.csrf import csrf_exempt from django.views.decorators.cache import never_cache @@ -109,7 +108,7 @@ def subscriptions(request, username, device_uid): try: update_urls = update_subscriptions(request.user, d, add, rem) - except IntegrityError, e: + except ValueError, e: return HttpResponseBadRequest(e) return JsonResponse({ @@ -122,7 +121,7 @@ def update_subscriptions(user, device, add, remove): for a in add: if a in remove: - raise IntegrityError('can not add and remove %s at the same time' % a) + raise ValueError('can not add and remove %s at the same time' % a) add_s = list(sanitize_urls(add, 'podcast')) rem_s = list(sanitize_urls(remove, 'podcast')) diff --git a/mygpo/api/legacy.py b/mygpo/api/legacy.py index b0ef2ab3..80b6eb61 100644 --- a/mygpo/api/legacy.py +++ b/mygpo/api/legacy.py @@ -69,11 +69,7 @@ def upload(request): rem = list(set(rem)) for n in new: - try: - p = podcast_for_url(n, create=True) - except IntegrityError, e: - log('/upload: Error trying to get podcast object: %s (error: %s)' % (n, e)) - continue + p = podcast_for_url(n, create=True) try: p.subscribe(user, dev) -- 2.11.4.GIT