Skip to content

Commit be51a99

Browse files
committed
Use get_object_or_404 in show() to avoid raising an exception
with a handcrafted URL pointing to an incorrect ID. - Legacy-Id: 811
1 parent e58a0e9 commit be51a99

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ietf/ipr/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright The IETF Trust 2007, All Rights Reserved
22

33
import django.utils.html
4-
from django.shortcuts import render_to_response as render
4+
from django.shortcuts import render_to_response as render, get_object_or_404
55
from django.template import RequestContext
66
from django.utils.html import escape
77
from django.http import Http404
@@ -47,7 +47,7 @@ def list_all(request, template):
4747
def show(request, ipr_id=None):
4848
"""Show a specific IPR disclosure"""
4949
assert ipr_id != None
50-
ipr = IprDetail.objects.get(ipr_id=ipr_id)
50+
get_object_or_404(IprDetail, ipr_id=ipr_id)
5151
if not ipr.status == 1:
5252
raise Http404
5353
section_list = get_section_list(ipr)

0 commit comments

Comments
 (0)