raise a 404 error if attachment cant be found

This commit is contained in:
Sean McArthur 2011-04-29 12:34:56 -07:00
Родитель 31af8b21ba
Коммит b56bc5d793
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -768,7 +768,8 @@ def package_remove_attachment(r, id_number, type_id, revision_number):
return HttpResponseForbidden('You are not the author of this Package')
uid = r.POST.get('uid', '').strip()
attachment = Attachment.objects.get(pk=uid, revisions=revision)
attachment = get_object_with_related_or_404(Attachment,
pk=uid, revisions=revision)
if not attachment:
log_msg = ('Attempt to remove a non existing attachment. attachment: '