Added IPR search by RFC number.
- Legacy-Id: 400
This commit is contained in:
parent
a746d9099a
commit
6a2c3ab85f
|
@ -10,4 +10,6 @@
|
||||||
200 /ipr/search/ https://datatracker.ietf.org/public/ipr_search.cgi
|
200 /ipr/search/ https://datatracker.ietf.org/public/ipr_search.cgi
|
||||||
302 /ipr/search/?option=document_search # incomplete argument set gives redirect
|
302 /ipr/search/?option=document_search # incomplete argument set gives redirect
|
||||||
200 /ipr/search/?option=document_search&document_search=mod https://datatracker.ietf.org/public/ipr_search.cgi?option=document_search&document_search=mod
|
200 /ipr/search/?option=document_search&document_search=mod https://datatracker.ietf.org/public/ipr_search.cgi?option=document_search&document_search=mod
|
||||||
200 /ipr/search/?option=document_search&id_document_tag=2220 https://datatracker.ietf.org/public/ipr_search.cgi?option=document_search&id_document_tag=2220
|
200,sort /ipr/search/?option=document_search&id_document_tag=2220 https://datatracker.ietf.org/public/ipr_search.cgi?option=document_search&id_document_tag=2220
|
||||||
|
200,sort /ipr/search/?option=rfc_search&rfc_search=1034 https://datatracker.ietf.org/public/ipr_search.cgi?option=rfc_search&rfc_search=1034 # Loong result, RFC search
|
||||||
|
200 /ipr/search/?option=rfc_search&rfc_search=4444 https://datatracker.ietf.org/public/ipr_search.cgi?option=rfc_search&rfc_search=4444 # Empty result, RFC search
|
||||||
|
|
|
@ -90,7 +90,7 @@ inverse = {
|
||||||
}
|
}
|
||||||
|
|
||||||
display_relation = {
|
display_relation = {
|
||||||
'updates': 'that updates',
|
'updates': 'that updated',
|
||||||
'is_updated_by': 'that was updated by',
|
'is_updated_by': 'that was updated by',
|
||||||
'obsoletes': 'that obsoleted',
|
'obsoletes': 'that obsoleted',
|
||||||
'is_obsoleted_by': 'that was obsoleted by',
|
'is_obsoleted_by': 'that was obsoleted by',
|
||||||
|
@ -101,7 +101,7 @@ display_relation = {
|
||||||
}
|
}
|
||||||
|
|
||||||
def set_related(obj, rel, target):
|
def set_related(obj, rel, target):
|
||||||
print obj, rel, target
|
#print obj, rel, target
|
||||||
# remember only the first relationship we find.
|
# remember only the first relationship we find.
|
||||||
if not hasattr(obj, "related"):
|
if not hasattr(obj, "related"):
|
||||||
obj.related = target
|
obj.related = target
|
||||||
|
@ -112,7 +112,7 @@ def set_relation(first, rel, second):
|
||||||
set_related(second, inverse[rel], first)
|
set_related(second, inverse[rel], first)
|
||||||
|
|
||||||
def related_docs(doc, found = []):
|
def related_docs(doc, found = []):
|
||||||
print "\nrelated_docs(%s, %s)" % (doc, found)
|
#print "\nrelated_docs(%s, %s)" % (doc, found)
|
||||||
found.append(doc)
|
found.append(doc)
|
||||||
if isinstance(doc, Rfc):
|
if isinstance(doc, Rfc):
|
||||||
try:
|
try:
|
||||||
|
@ -136,9 +136,9 @@ def related_docs(doc, found = []):
|
||||||
found = related_docs(item, found)
|
found = related_docs(item, found)
|
||||||
if isinstance(doc, InternetDraft):
|
if isinstance(doc, InternetDraft):
|
||||||
if doc.replaced_by_id:
|
if doc.replaced_by_id:
|
||||||
item = doc.replaced_by_id
|
item = doc.replaced_by
|
||||||
if not item in found:
|
if not item in found:
|
||||||
set_relation(doc, 'replaced_by', item)
|
set_relation(doc, 'is_replaced_by', item)
|
||||||
found = related_docs(item, found)
|
found = related_docs(item, found)
|
||||||
for item in doc.replaces_set.all():
|
for item in doc.replaces_set.all():
|
||||||
if not item in found:
|
if not item in found:
|
||||||
|
@ -165,32 +165,46 @@ def search(request, type="", q="", id=""):
|
||||||
if type and q or id:
|
if type and q or id:
|
||||||
log("Got query: type=%s, q=%s, id=%s" % (type, q, id))
|
log("Got query: type=%s, q=%s, id=%s" % (type, q, id))
|
||||||
if type == "document_search":
|
if type == "document_search":
|
||||||
log("Got document_search")
|
|
||||||
if q:
|
if q:
|
||||||
start = InternetDraft.objects.filter(filename__contains=q)
|
start = InternetDraft.objects.filter(filename__contains=q)
|
||||||
log("Found %s drafts containing %s" % (start.count(), q))
|
|
||||||
if id:
|
if id:
|
||||||
start = InternetDraft.objects.filter(id_document_tag=id)
|
start = InternetDraft.objects.filter(id_document_tag=id)
|
||||||
log("Found %s drafts with id %s" % (start.count(), id))
|
elif type == "rfc_search":
|
||||||
if start.count() == 1:
|
if q:
|
||||||
first = start[0]
|
start = Rfc.objects.filter(rfc_number=q)
|
||||||
# get all related drafts, then search for IPRs on all
|
elif type == "patent_search":
|
||||||
docs = related_docs(first, [])
|
pass
|
||||||
iprs = []
|
elif type == "patent_info_search":
|
||||||
for doc in docs:
|
pass
|
||||||
if isinstance(doc, InternetDraft):
|
elif type == "wg_search":
|
||||||
disclosures = [ item.ipr for item in IprDraft.objects.filter(document=doc) ]
|
pass
|
||||||
elif isinstance(doc, Rfc):
|
elif type == "title_search":
|
||||||
disclosures = [ item.ipr for item in IprRfc.objects.filter(document=doc) ]
|
pass
|
||||||
else:
|
elif type == "ip_title_search":
|
||||||
raise ValueError("Neither draft nor rfc: %s" % doc)
|
pass
|
||||||
if disclosures:
|
else:
|
||||||
doc.iprs = disclosures
|
raise ValueError("Unexpected search type in IPR query: %s" % type)
|
||||||
iprs += disclosures
|
if start.count() == 1:
|
||||||
iprs = list(set(iprs))
|
first = start[0]
|
||||||
return render("ipr/search_result.html", {"first": first, "iprs": iprs, "docs": docs})
|
# get all related drafts, then search for IPRs on all
|
||||||
elif start.count():
|
docs = related_docs(first, [])
|
||||||
return render("ipr/search_list.html", {"docs": start })
|
iprs = []
|
||||||
|
for doc in docs:
|
||||||
|
if isinstance(doc, InternetDraft):
|
||||||
|
disclosures = [ item.ipr for item in IprDraft.objects.filter(document=doc) ]
|
||||||
|
elif isinstance(doc, Rfc):
|
||||||
|
disclosures = [ item.ipr for item in IprRfc.objects.filter(document=doc) ]
|
||||||
|
else:
|
||||||
|
raise ValueError("Doc type is neither draft nor rfc: %s" % doc)
|
||||||
|
if disclosures:
|
||||||
|
doc.iprs = disclosures
|
||||||
|
iprs += disclosures
|
||||||
|
iprs = list(set(iprs))
|
||||||
|
return render("ipr/search_result.html", {"first": first, "iprs": iprs, "docs": docs})
|
||||||
|
elif start.count():
|
||||||
|
return render("ipr/search_list.html", {"docs": start })
|
||||||
|
else:
|
||||||
|
raise ValueError("Missing or malformed search parameters, or internal error")
|
||||||
return django.http.HttpResponseRedirect(request.path)
|
return django.http.HttpResponseRedirect(request.path)
|
||||||
return render("ipr/search.html", {"wgs": wgs})
|
return render("ipr/search.html", {"wgs": wgs})
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<tbody bgcolor="#{% cycle dadada,eaeaea as bgcolor %}">
|
<tbody bgcolor="#{% cycle dadada,eaeaea as bgcolor %}">
|
||||||
<tr >
|
<tr >
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
Search result on {{ doc }}, "{{ doc.title }}"{% ifnotequal doc first %}{% if doc.related %}, {{ doc.relation }} {{ doc.related }}, "{{ doc.related.title }}"{% endif %}
|
Search result on {{ doc|rfcspace|lstrip:"0"|rfcnospace }}, "{{ doc.title }}"{% ifnotequal doc first %}{% if doc.related %}, {{ doc.relation }} {{ doc.related }}, "{{ doc.related.title }}"{% endif %}
|
||||||
{% endifnotequal %}
|
{% endifnotequal %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td colspan="2"><b>No IPR disclosures related to <i>{{ doc|rfcspace }}</i> have been submitted</b></td>
|
<td colspan="2"><b>No IPR disclosures related to <i>{{ doc|rfcspace|lstrip:"0" }}</i> have been submitted</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue