IPR search: handle non-numeric RFC numbers/ID document tags gracefully (instead of uncaught exception)

- Legacy-Id: 1987
This commit is contained in:
Pasi Eronen 2010-02-17 11:58:48 +00:00
parent ce33a4a30f
commit 294f812646
2 changed files with 10 additions and 0 deletions

View file

@ -71,9 +71,17 @@ def search(request, type="", q="", id=""):
q = normalize_draftname(q)
start = InternetDraft.objects.filter(filename__contains=q)
if id:
try:
id = int(id,10)
except:
id = -1
start = InternetDraft.objects.filter(id_document_tag=id)
if type == "rfc_search":
if q:
try:
q = int(q, 10)
except:
q = -1
start = Rfc.objects.filter(rfc_number=q)
if start.count() == 1:
first = start[0]

View file

@ -39,11 +39,13 @@
200 /ipr/search/?document_search=mod&option=document_search # Returns document list
200 /ipr/search/?id_document_tag=2220&option=document_search # Simple case
200 /ipr/search/?id_document_tag=2221&option=document_search # Empty result
200 /ipr/search/?id_document_tag=2221x&option=document_search # Non-numeric
200 /ipr/search/?option=document_search&document_search=draft-housley-tls-authz-extns-05 # More complex result
200 /ipr/search/?rfc_search=1034&option=rfc_search # Loong result
200 /ipr/search/?rfc_search=4555&option=rfc_search # Simple result
200 /ipr/search/?rfc_search=4444&option=rfc_search # Empty result
200 /ipr/search/?rfc_search=4xyz&option=rfc_search # non-numeric
200 /ipr/search/?patent_search=nortel&option=patent_search
200 /ipr/search/?patent_search=nortelxz&option=patent_search # Empty result