Commit 32fc0f16 authored by jc's avatar jc

fixes Pokemon exception handling

parent 5f87e532
......@@ -30,7 +30,7 @@ status_map = dict(STATUS)
def status(code):
try:
return status_map[code]
except:
except Exception:
return code
......@@ -41,7 +41,7 @@ type_map = dict(TYPES)
def type(code):
try:
return type_map[code]
except:
except Exception:
return code
......@@ -52,5 +52,5 @@ media_map = dict(MEDIA)
def media(code):
try:
return media_map[code]
except:
except Exception:
return code
......@@ -55,7 +55,7 @@ def sanitizeHtml(value, base_url=None):
def activate(request):
try:
v = Violation.objects.get(activationid=request.GET.get('key', 'asdf'))
except:
except Exception:
messages.add_message(request, messages.INFO, unicode(_('Thank you, this key has been already activated')))
return HttpResponseRedirect('/') # Redirect after POST
if v:
......@@ -80,7 +80,7 @@ def activate(request):
def moderate(request):
try:
v = Violation.objects.get(activationid=request.GET.get('key', 'asdf'))
except:
except Exception:
messages.add_message(request, messages.INFO, unicode(_('Thank you, this key has been already activated')))
return HttpResponseRedirect('/') # Redirect after POST
if not v:
......@@ -101,7 +101,7 @@ def moderate(request):
try:
settings.TWITTER_API.PostUpdate("New #NetNeutrality violation reported for %s (%s) %s %s/%s" %
(v.operator, v.country, v.contract, settings.ROOT_URL or 'http://localhost:8001/', v.id))
except:
except Exception:
pass
v.activationid = ''
v.save()
......@@ -127,14 +127,14 @@ def confirm(request, id, name=None):
actid = sendverifymail('confirm/', name, msg)
try:
c = Confirmation(key=actid, email=name, violation=violation)
except:
except Exception:
# should except IntegrityError properly
return HttpResponse(unicode(_('Thank you, this has been already confirmed')))
c.save()
return HttpResponse(unicode(_('Thank you for your confirmation')))
try:
c = get_object_or_404(Confirmation, key=id)
except:
except Exception:
messages.add_message(request, messages.INFO, unicode(_("Thank you, this has been already confirmed")))
return HttpResponseRedirect('/') # Redirect after POST
c.key = ''
......@@ -304,7 +304,7 @@ def get_attach(request, id):
response = HttpResponse(wrapper, content_type=f.type)
response['Content-Disposition'] = 'attachment; filename="%s"' % f.name
response['Content-Length'] = f.storage.size
except:
except Exception:
response = HttpResponseNotFound('<h1>Document not found.</h1>')
return response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment