euscanwww: raise Http404 -> return HttpResponseNotFound()

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-11-08 15:25:49 +01:00
parent c648d7e756
commit 7f55e00ed0

View File

@ -3,7 +3,7 @@
import inspect import inspect
from annoying.decorators import render_to, ajax_request from annoying.decorators import render_to, ajax_request
from django.http import Http404, HttpResponse from django.http import HttpResponse, HttpResponseNotFound
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
@ -58,7 +58,7 @@ def category(request, category):
packages = Package.objects.for_category(category, last_versions=True) packages = Package.objects.for_category(category, last_versions=True)
if not packages: if not packages:
raise Http404 return HttpResponseNotFound()
try: try:
last_scan = \ last_scan = \
@ -157,7 +157,7 @@ def overlays(request):
def overlay(request, overlay): def overlay(request, overlay):
packages = Package.objects.for_overlay(overlay) packages = Package.objects.for_overlay(overlay)
if not packages: if not packages:
raise Http404 return HttpResponseNotFound()
try: try:
last_scan = EuscanResult.objects.latest().datetime last_scan = EuscanResult.objects.latest().datetime
@ -228,7 +228,7 @@ def package_version_metadata(request, category, package, version_tag):
try: try:
ver, rev, slot, over = versiontag_to_attrs(version_tag) ver, rev, slot, over = versiontag_to_attrs(version_tag)
except TypeError: except TypeError:
raise Http404 return HttpResponseNotFound()
version = get_object_or_404(Version, package=package, version=ver, version = get_object_or_404(Version, package=package, version=ver,
revision=rev, slot=slot, overlay=over) revision=rev, slot=slot, overlay=over)
content = "" content = ""
@ -243,7 +243,7 @@ def package_version_ebuild(request, category, package, version_tag):
try: try:
ver, rev, slot, over = versiontag_to_attrs(version_tag) ver, rev, slot, over = versiontag_to_attrs(version_tag)
except TypeError: except TypeError:
raise Http404 return HttpResponseNotFound()
version = get_object_or_404(Version, package=package, version=ver, version = get_object_or_404(Version, package=package, version=ver,
revision=rev, slot=slot, overlay=over) revision=rev, slot=slot, overlay=over)
if version.ebuild_path: if version.ebuild_path:
@ -397,7 +397,7 @@ def chart(request, **kwargs):
elif chart == 'versions': elif chart == 'versions':
path = charts.versions(**kwargs) path = charts.versions(**kwargs)
else: else:
raise Http404 return HttpResponseNotFound()
return serve(request, path, document_root=charts.CHARTS_ROOT) return serve(request, path, document_root=charts.CHARTS_ROOT)