Additional IPR searches: WG search and holder (legal name) search.
- Legacy-Id: 644
This commit is contained in:
parent
d37b5bb9ed
commit
9074e9555c
|
@ -149,11 +149,11 @@ class IprContact(models.Model):
|
|||
|
||||
|
||||
class IprDraft(models.Model):
|
||||
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', raw_id_admin=True, core=True)
|
||||
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, edit_inline=True, related_name='drafts')
|
||||
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', raw_id_admin=True, core=True, related_name="ipr")
|
||||
revision = models.CharField(maxlength=2)
|
||||
def __str__(self):
|
||||
return "%s applies to %s-%s" % ( self.ipr, self.document, self.revision )
|
||||
return "%s which applies to %s-%s" % ( self.ipr, self.document, self.revision )
|
||||
class Meta:
|
||||
db_table = 'ipr_ids'
|
||||
class Admin:
|
||||
|
@ -173,9 +173,9 @@ class IprNotification(models.Model):
|
|||
|
||||
class IprRfc(models.Model):
|
||||
ipr = models.ForeignKey(IprDetail, edit_inline=True, related_name='rfcs')
|
||||
document = models.ForeignKey(Rfc, db_column='rfc_number', raw_id_admin=True, core=True)
|
||||
document = models.ForeignKey(Rfc, db_column='rfc_number', raw_id_admin=True, core=True, related_name="ipr")
|
||||
def __str__(self):
|
||||
return "%s applies to RFC%04d" % ( self.ipr, self.rfc_number )
|
||||
return "%s applies to RFC%04d" % ( self.ipr, self.document_id )
|
||||
class Meta:
|
||||
db_table = 'ipr_rfcs'
|
||||
class Admin:
|
||||
|
|
|
@ -28,6 +28,7 @@ def set_related(obj, rel, target):
|
|||
if not hasattr(obj, "related"):
|
||||
obj.related = target
|
||||
obj.relation = display_relation[rel]
|
||||
return obj
|
||||
|
||||
def set_relation(first, rel, second):
|
||||
set_related(first, rel, second)
|
||||
|
|
|
@ -7,6 +7,53 @@ from ietf.ipr.related import related_docs
|
|||
from ietf.utils import log
|
||||
|
||||
|
||||
def mark_last_doc(iprs):
|
||||
for item in iprs:
|
||||
if item.drafts.count():
|
||||
item.last_draft = item.drafts.all()[int(item.drafts.count())-1]
|
||||
if item.rfcs.count():
|
||||
item.last_rfc = item.rfcs.all()[int(item.rfcs.count())-1]
|
||||
|
||||
def mark_related_doc(iprs):
|
||||
for item in iprs:
|
||||
print "*** Item:", item
|
||||
for entry in item.drafts.all():
|
||||
print " ** Entry:", entry
|
||||
print " * Doc:", entry.document
|
||||
related_docs(entry.document, [])
|
||||
print " Doc relation:", entry.document.relation
|
||||
print " Doc related :", entry.document.related
|
||||
for entry in item.rfcs.all():
|
||||
print " ** Entry:", entry
|
||||
print " * Doc:", entry.document
|
||||
related_docs(entry.document, [])
|
||||
print " Doc relation:", entry.document.relation
|
||||
print " Doc related :", entry.document.related
|
||||
|
||||
def unique_iprs(iprs):
|
||||
ids = []
|
||||
unique = []
|
||||
for ipr in iprs:
|
||||
if not ipr.ipr_id in ids:
|
||||
ids += [ ipr.ipr_id ]
|
||||
unique += [ ipr ]
|
||||
return unique
|
||||
|
||||
def iprs_from_docs(docs):
|
||||
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 iprs
|
||||
|
||||
def search(request, type="", q="", id=""):
|
||||
wgs = IETFWG.objects.filter(group_type__group_type_id=1).exclude(group_acronym__acronym='2000').select_related().order_by('acronym.acronym')
|
||||
args = request.REQUEST.items()
|
||||
|
@ -37,18 +84,7 @@ def search(request, type="", q="", id=""):
|
|||
|
||||
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))
|
||||
iprs = iprs_from_docs(docs)
|
||||
return render("ipr/search_doc_result.html", {"q": q, "first": first, "iprs": iprs, "docs": docs})
|
||||
elif start.count():
|
||||
return render("ipr/search_doc_list.html", {"q": q, "docs": start })
|
||||
|
@ -62,11 +98,7 @@ def search(request, type="", q="", id=""):
|
|||
iprs = [ ipr for ipr in iprs if not ipr.updated_by.all() ]
|
||||
# Some extra information, to help us render 'and' between the
|
||||
# last two documents in a sequence
|
||||
for ipr in iprs:
|
||||
if ipr.drafts.count():
|
||||
ipr.last_draft = ipr.drafts.all()[int(ipr.drafts.count())-1]
|
||||
if ipr.rfcs.count():
|
||||
ipr.last_rfc = ipr.rfcs.all()[int(ipr.rfcs.count())-1]
|
||||
mark_last_doc(iprs)
|
||||
return render("ipr/search_holder_result.html", {"q": q, "iprs": iprs, "count": count } )
|
||||
|
||||
# Search by content of email or pagent_info field
|
||||
|
@ -75,7 +107,18 @@ def search(request, type="", q="", id=""):
|
|||
|
||||
# Search by wg acronym
|
||||
elif type == "wg_search":
|
||||
pass
|
||||
try:
|
||||
docs = list(InternetDraft.objects.filter(group__acronym=q))
|
||||
except:
|
||||
docs = []
|
||||
docs += [ draft.replaced_by for draft in docs if draft.replaced_by_id ]
|
||||
docs += list(Rfc.objects.filter(group_acronym=q))
|
||||
|
||||
docs = [ doc for doc in docs if doc.ipr.count() ]
|
||||
iprs = iprs_from_docs(docs)
|
||||
count = len(iprs)
|
||||
#mark_last_doc(iprs)
|
||||
return render("ipr/search_wg_result.html", {"q": q, "docs": docs, "iprs": iprs, "count": count } )
|
||||
|
||||
# Search by rfc and id title
|
||||
elif type == "title_search":
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
200 /ipr/search/?rfc_search=4444&option=rfc_search https://datatracker.ietf.org/public/ipr_search.cgi?option=rfc_search&rfc_search=4444 # Empty result, RFC search
|
||||
200 /ipr/about/ https://datatracker.ietf.org/public/ipr_disclosure.cgi
|
||||
200 /ipr/search/?patent_search=nortel&option=patent_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_search&patent_search=nortel
|
||||
|
||||
200,sort,ignore:quote /ipr/search/?wg_search=dnsext&option=wg_search https://datatracker.ietf.org/public/ipr_search.cgi?option=wg_search&wg_search=dnsext
|
||||
200 /ipr/2006/
|
||||
200 /ipr/2006/feb/
|
||||
200 /ipr/by-date/
|
||||
|
|
Loading…
Reference in a new issue