Somewhat reorganized IPR search code. Renamed IprDetails model field. New IPR search templates.
- Legacy-Id: 476
This commit is contained in:
parent
61983079e4
commit
92968fa04e
|
@ -60,7 +60,7 @@ class IprDetail(models.Model):
|
|||
additional_old_url2 = models.CharField(blank=True, maxlength=255)
|
||||
|
||||
# Patent holder fieldset
|
||||
p_h_legal_name = models.CharField("Legal Name", maxlength=255)
|
||||
legal_name = models.CharField("Legal Name", db_column="p_h_legal_name", maxlength=255)
|
||||
|
||||
# Patent Holder Contact fieldset
|
||||
# self.contacts.filter(contact_type=1)
|
||||
|
|
|
@ -177,13 +177,13 @@ def new(request, type):
|
|||
data["comply"] = "1"
|
||||
|
||||
if type == "general":
|
||||
data["document_title"] = """%(p_h_legal_name)s's General License Statement""" % data
|
||||
data["document_title"] = """%(legal_name)s's General License Statement""" % data
|
||||
if type == "specific":
|
||||
data["ipr_summary"] = get_ipr_summary(data)
|
||||
data["document_title"] = """%(p_h_legal_name)s's Statement about IPR related to %(ipr_summary)s""" % data
|
||||
data["document_title"] = """%(legal_name)s's Statement about IPR related to %(ipr_summary)s""" % data
|
||||
if type == "third-party":
|
||||
data["ipr_summary"] = get_ipr_summary(data)
|
||||
data["document_title"] = """%(submitter)s's Statement about IPR related to %(ipr_summary)s belonging to %(p_h_legal_name)s""" % data
|
||||
data["document_title"] = """%(submitter)s's Statement about IPR related to %(ipr_summary)s belonging to %(legal_name)s""" % data
|
||||
|
||||
for src in ["hold", "ietf"]:
|
||||
if "%s_contact_is_submitter" % src in data:
|
||||
|
|
|
@ -8,6 +8,7 @@ from ietf.ipr.view_sections import section_table
|
|||
from ietf.ipr.view_new import new
|
||||
from ietf.utils import log
|
||||
|
||||
|
||||
def linebreaks(value):
|
||||
if value:
|
||||
return django.utils.html.linebreaks(value)
|
||||
|
@ -112,6 +113,8 @@ def set_relation(first, rel, second):
|
|||
set_related(second, inverse[rel], first)
|
||||
|
||||
def related_docs(doc, found = []):
|
||||
"""Get a list of document related to the given document.
|
||||
"""
|
||||
#print "\nrelated_docs(%s, %s)" % (doc, found)
|
||||
found.append(doc)
|
||||
if isinstance(doc, Rfc):
|
||||
|
@ -164,14 +167,38 @@ def search(request, type="", q="", id=""):
|
|||
id = value
|
||||
if type and q or id:
|
||||
log("Got query: type=%s, q=%s, id=%s" % (type, q, id))
|
||||
if type in ["document_search", "rfc_search"]:
|
||||
if type == "document_search":
|
||||
if q:
|
||||
start = InternetDraft.objects.filter(filename__contains=q)
|
||||
if id:
|
||||
start = InternetDraft.objects.filter(id_document_tag=id)
|
||||
elif type == "rfc_search":
|
||||
if type == "rfc_search":
|
||||
if q:
|
||||
start = Rfc.objects.filter(rfc_number=q)
|
||||
if start.count() == 1:
|
||||
first = start[0]
|
||||
# get all related drafts, then search for IPRs on all
|
||||
|
||||
docs = related_docs(first, [])
|
||||
#docs = get_doclist.get_doclist(first)
|
||||
iprs = []
|
||||
for doc in docs:
|
||||
if isinstance(doc, InternetDraft):
|
||||
disclosures = [ item.ipr for item in IprDraft.objects.filter(document=doc, ipr__status__in=[1,3]) ]
|
||||
elif isinstance(doc, Rfc):
|
||||
disclosures = [ item.ipr for item in IprRfc.objects.filter(document=doc, ipr__status__in=[1,3]) ]
|
||||
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_doc_result.html", {"first": first, "iprs": iprs, "docs": docs})
|
||||
elif start.count():
|
||||
return render("ipr/search_doc_list.html", {"docs": start })
|
||||
else:
|
||||
raise ValueError("Missing or malformed search parameters, or internal error")
|
||||
elif type == "patent_search":
|
||||
pass
|
||||
elif type == "patent_info_search":
|
||||
|
@ -184,27 +211,6 @@ def search(request, type="", q="", id=""):
|
|||
pass
|
||||
else:
|
||||
raise ValueError("Unexpected search type in IPR query: %s" % type)
|
||||
if start.count() == 1:
|
||||
first = start[0]
|
||||
# get all related drafts, then search for IPRs on all
|
||||
docs = related_docs(first, [])
|
||||
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 render("ipr/search.html", {"wgs": wgs})
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
</tr>
|
||||
<tr class="{% cycle row_parity %}">
|
||||
{% block section1_data %}
|
||||
<td class="fixwidth">Legal Name:</td> <td><b> {{ ipr.p_h_legal_name }} </b></td>
|
||||
<td class="fixwidth">Legal Name:</td> <td><b> {{ ipr.legal_name }} </b></td>
|
||||
{% endblock %}
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue