Skip to content

Commit 92968fa

Browse files
committed
Somewhat reorganized IPR search code. Renamed IprDetails model field. New IPR search templates.
- Legacy-Id: 476
1 parent 6198307 commit 92968fa

6 files changed

Lines changed: 40 additions & 34 deletions

File tree

ietf/ipr/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class IprDetail(models.Model):
6060
additional_old_url2 = models.CharField(blank=True, maxlength=255)
6161

6262
# Patent holder fieldset
63-
p_h_legal_name = models.CharField("Legal Name", maxlength=255)
63+
legal_name = models.CharField("Legal Name", db_column="p_h_legal_name", maxlength=255)
6464

6565
# Patent Holder Contact fieldset
6666
# self.contacts.filter(contact_type=1)

ietf/ipr/view_new.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ def clean_submitter(self):
177177
data["comply"] = "1"
178178

179179
if type == "general":
180-
data["document_title"] = """%(p_h_legal_name)s's General License Statement""" % data
180+
data["document_title"] = """%(legal_name)s's General License Statement""" % data
181181
if type == "specific":
182182
data["ipr_summary"] = get_ipr_summary(data)
183-
data["document_title"] = """%(p_h_legal_name)s's Statement about IPR related to %(ipr_summary)s""" % data
183+
data["document_title"] = """%(legal_name)s's Statement about IPR related to %(ipr_summary)s""" % data
184184
if type == "third-party":
185185
data["ipr_summary"] = get_ipr_summary(data)
186-
data["document_title"] = """%(submitter)s's Statement about IPR related to %(ipr_summary)s belonging to %(p_h_legal_name)s""" % data
186+
data["document_title"] = """%(submitter)s's Statement about IPR related to %(ipr_summary)s belonging to %(legal_name)s""" % data
187187

188188
for src in ["hold", "ietf"]:
189189
if "%s_contact_is_submitter" % src in data:

ietf/ipr/views.py

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ietf.ipr.view_new import new
99
from ietf.utils import log
1010

11+
1112
def linebreaks(value):
1213
if value:
1314
return django.utils.html.linebreaks(value)
@@ -112,6 +113,8 @@ def set_relation(first, rel, second):
112113
set_related(second, inverse[rel], first)
113114

114115
def related_docs(doc, found = []):
116+
"""Get a list of document related to the given document.
117+
"""
115118
#print "\nrelated_docs(%s, %s)" % (doc, found)
116119
found.append(doc)
117120
if isinstance(doc, Rfc):
@@ -164,14 +167,38 @@ def search(request, type="", q="", id=""):
164167
id = value
165168
if type and q or id:
166169
log("Got query: type=%s, q=%s, id=%s" % (type, q, id))
167-
if type == "document_search":
168-
if q:
169-
start = InternetDraft.objects.filter(filename__contains=q)
170-
if id:
171-
start = InternetDraft.objects.filter(id_document_tag=id)
172-
elif type == "rfc_search":
173-
if q:
174-
start = Rfc.objects.filter(rfc_number=q)
170+
if type in ["document_search", "rfc_search"]:
171+
if type == "document_search":
172+
if q:
173+
start = InternetDraft.objects.filter(filename__contains=q)
174+
if id:
175+
start = InternetDraft.objects.filter(id_document_tag=id)
176+
if type == "rfc_search":
177+
if q:
178+
start = Rfc.objects.filter(rfc_number=q)
179+
if start.count() == 1:
180+
first = start[0]
181+
# get all related drafts, then search for IPRs on all
182+
183+
docs = related_docs(first, [])
184+
#docs = get_doclist.get_doclist(first)
185+
iprs = []
186+
for doc in docs:
187+
if isinstance(doc, InternetDraft):
188+
disclosures = [ item.ipr for item in IprDraft.objects.filter(document=doc, ipr__status__in=[1,3]) ]
189+
elif isinstance(doc, Rfc):
190+
disclosures = [ item.ipr for item in IprRfc.objects.filter(document=doc, ipr__status__in=[1,3]) ]
191+
else:
192+
raise ValueError("Doc type is neither draft nor rfc: %s" % doc)
193+
if disclosures:
194+
doc.iprs = disclosures
195+
iprs += disclosures
196+
iprs = list(set(iprs))
197+
return render("ipr/search_doc_result.html", {"first": first, "iprs": iprs, "docs": docs})
198+
elif start.count():
199+
return render("ipr/search_doc_list.html", {"docs": start })
200+
else:
201+
raise ValueError("Missing or malformed search parameters, or internal error")
175202
elif type == "patent_search":
176203
pass
177204
elif type == "patent_info_search":
@@ -184,27 +211,6 @@ def search(request, type="", q="", id=""):
184211
pass
185212
else:
186213
raise ValueError("Unexpected search type in IPR query: %s" % type)
187-
if start.count() == 1:
188-
first = start[0]
189-
# get all related drafts, then search for IPRs on all
190-
docs = related_docs(first, [])
191-
iprs = []
192-
for doc in docs:
193-
if isinstance(doc, InternetDraft):
194-
disclosures = [ item.ipr for item in IprDraft.objects.filter(document=doc) ]
195-
elif isinstance(doc, Rfc):
196-
disclosures = [ item.ipr for item in IprRfc.objects.filter(document=doc) ]
197-
else:
198-
raise ValueError("Doc type is neither draft nor rfc: %s" % doc)
199-
if disclosures:
200-
doc.iprs = disclosures
201-
iprs += disclosures
202-
iprs = list(set(iprs))
203-
return render("ipr/search_result.html", {"first": first, "iprs": iprs, "docs": docs})
204-
elif start.count():
205-
return render("ipr/search_list.html", {"docs": start })
206-
else:
207-
raise ValueError("Missing or malformed search parameters, or internal error")
208214
return django.http.HttpResponseRedirect(request.path)
209215
return render("ipr/search.html", {"wgs": wgs})
210216

ietf/templates/ipr/details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ <h4 class="ipr">The Patent Disclosure and Licensing Declaration Template for {{
190190
</tr>
191191
<tr class="{% cycle row_parity %}">
192192
{% block section1_data %}
193-
<td class="fixwidth">Legal Name:</td> <td><b> {{ ipr.p_h_legal_name }} </b></td>
193+
<td class="fixwidth">Legal Name:</td> <td><b> {{ ipr.legal_name }} </b></td>
194194
{% endblock %}
195195
</tr>
196196
</table>

0 commit comments

Comments
 (0)