Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow blanket IPR disclosures #7934

Merged
merged 14 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ietf/ipr/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,19 @@ def clean(self):

return cleaned_data


class HolderIprDisclosureForm(IprDisclosureFormBase):
is_blanket_disclosure = forms.BooleanField(
label=mark_safe(
'This is a blanket IPR disclosure '
'(see Section 5.4.3 of <a href="https://www.ietf.org/rfc/rfc8179.txt">RFC 8179</a>)'
),
help_text="In satisfaction of its disclosure obligations, Patent Holder commits to license all of "
"IPR (as defined in RFC 8179) that would have required disclosure under RFC 8179 on a "
"royalty-free (and otherwise reasonable and non-discriminatory) basis. Patent Holder "
"confirms that all other terms and conditions are described in this IPR disclosure.",
required=False,
)
licensing = CustomModelChoiceField(IprLicenseTypeName.objects.all(),
widget=forms.RadioSelect,empty_label=None)

Expand All @@ -356,6 +368,15 @@ def __init__(self, *args, **kwargs):
else:
# entering new disclosure
self.fields['licensing'].queryset = IprLicenseTypeName.objects.exclude(slug='none-selected')

if self.data.get("is_blanket_disclosure", False):
# for a blanket disclosure, patent details are not required
self.fields["patent_number"].required = False
self.fields["patent_inventor"].required = False
self.fields["patent_title"].required = False
self.fields["patent_date"].required = False
# n.b., self.fields["patent_notes"] is never required


def clean(self):
cleaned_data = super(HolderIprDisclosureForm, self).clean()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright The IETF Trust 2024, All Rights Reserved
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("ipr", "0003_alter_iprdisclosurebase_docs"),
]

operations = [
migrations.AddField(
model_name="holderiprdisclosure",
name="is_blanket_disclosure",
field=models.BooleanField(default=False),
),
]
34 changes: 24 additions & 10 deletions ietf/ipr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from django.utils import timezone
Expand Down Expand Up @@ -124,17 +125,30 @@ def is_thirdparty(self):


class HolderIprDisclosure(IprDisclosureBase):
ietfer_name = models.CharField(max_length=255, blank=True) # "Whose Personal Belief Triggered..."
ietfer_contact_email = models.EmailField(blank=True)
ietfer_contact_info = models.TextField(blank=True)
patent_info = models.TextField()
has_patent_pending = models.BooleanField(default=False)
holder_contact_email = models.EmailField()
holder_contact_name = models.CharField(max_length=255)
holder_contact_info = models.TextField(blank=True, help_text="Address, phone, etc.")
licensing = ForeignKey(IprLicenseTypeName)
licensing_comments = models.TextField(blank=True)
ietfer_name = models.CharField(
max_length=255, blank=True
) # "Whose Personal Belief Triggered..."
ietfer_contact_email = models.EmailField(blank=True)
ietfer_contact_info = models.TextField(blank=True)
patent_info = models.TextField()
has_patent_pending = models.BooleanField(default=False)
holder_contact_email = models.EmailField()
holder_contact_name = models.CharField(max_length=255)
holder_contact_info = models.TextField(blank=True, help_text="Address, phone, etc.")
licensing = ForeignKey(IprLicenseTypeName)
licensing_comments = models.TextField(blank=True)
submitter_claims_all_terms_disclosed = models.BooleanField(default=False)
is_blanket_disclosure = models.BooleanField(default=False)

def clean(self):
if self.is_blanket_disclosure:
# If the IprLicenseTypeName does not exist, we have a serious problem and a 500 response is ok,
# so not handling failure of the `get()`
royalty_free_licensing = IprLicenseTypeName.objects.get(slug="royalty-free")
if self.licensing_id != royalty_free_licensing.pk:
raise ValidationError(
f'Must select "{royalty_free_licensing.desc}" for a blanket IPR disclosure.')


class ThirdPartyIprDisclosure(IprDisclosureBase):
ietfer_name = models.CharField(max_length=255) # "Whose Personal Belief Triggered..."
Expand Down
78 changes: 68 additions & 10 deletions ietf/ipr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
IprDocRelFactory,
IprEventFactory
)
from ietf.ipr.forms import DraftForm
from ietf.ipr.forms import DraftForm, HolderIprDisclosureForm
from ietf.ipr.mail import (process_response_email, get_reply_to, get_update_submitter_emails,
get_pseudo_submitter, get_holders, get_update_cc_addrs)
from ietf.ipr.models import (IprDisclosureBase,GenericIprDisclosure,HolderIprDisclosure,
Expand Down Expand Up @@ -272,16 +272,16 @@ def test_sitemap(self):

def test_new_generic(self):
"""Ensure new-generic redirects to new-general"""
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "generic" })
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "generic" })
r = self.client.get(url)
self.assertEqual(r.status_code,302)
self.assertEqual(urlparse(r["Location"]).path, urlreverse("ietf.ipr.views.new", kwargs={ "type": "general"}))
self.assertEqual(urlparse(r["Location"]).path, urlreverse("ietf.ipr.views.new", kwargs={ "_type": "general"}))


def test_new_general(self):
"""Add a new general disclosure. Note: submitter does not need to be logged in.
"""
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "general" })
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "general" })

# invalid post
r = self.client.post(url, {
Expand Down Expand Up @@ -319,7 +319,7 @@ def test_new_specific(self):
"""
draft = WgDraftFactory()
rfc = WgRfcFactory()
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" })
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" })

# successful post
empty_outbox()
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_new_specific(self):
def test_new_specific_no_revision(self):
draft = WgDraftFactory()
rfc = WgRfcFactory()
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" })
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" })

# successful post
empty_outbox()
Expand Down Expand Up @@ -409,7 +409,7 @@ def test_new_thirdparty(self):
"""
draft = WgDraftFactory()
rfc = WgRfcFactory()
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "third-party" })
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "third-party" })

# successful post
empty_outbox()
Expand Down Expand Up @@ -456,7 +456,7 @@ def test_edit(self):
r = self.client.get(url)
self.assertContains(r, original_ipr.holder_legal_name)

#url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" })
#url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" })
# successful post
empty_outbox()
post_data = {
Expand Down Expand Up @@ -503,7 +503,7 @@ def test_update(self):
r = self.client.get(url)
self.assertContains(r, original_ipr.title)

#url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" })
#url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" })
# successful post
empty_outbox()
r = self.client.post(url, {
Expand Down Expand Up @@ -543,7 +543,7 @@ def test_update(self):

def test_update_bad_post(self):
draft = WgDraftFactory()
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" })
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" })

empty_outbox()
r = self.client.post(url, {
Expand Down Expand Up @@ -1022,3 +1022,61 @@ def test_revisions_invalid(self):
"revisions",
null_char_error_msg,
)


class HolderIprDisclosureFormTests(TestCase):
def setUp(self):
super().setUp()
# Checkboxes that are False are left out of the Form data, not sent back at all. These are
# commented out - if they were checked, their value would be "on".
self.data = {
"holder_legal_name": "Test Legal",
"holder_contact_name": "Test Holder",
"holder_contact_email": "[email protected]",
"holder_contact_info": "555-555-0100",
"ietfer_name": "Test Participant",
"ietfer_contact_info": "555-555-0101",
"iprdocrel_set-TOTAL_FORMS": 2,
"iprdocrel_set-INITIAL_FORMS": 0,
"iprdocrel_set-0-document": "1234", # fake id - validates but won't save()
"iprdocrel_set-0-revisions": '00',
"iprdocrel_set-1-document": "4567", # fake id - validates but won't save()
# "is_blanket_disclosure": "on",
"patent_number": "SE12345678901",
"patent_inventor": "A. Nonymous",
"patent_title": "A method of transferring bits",
"patent_date": "2000-01-01",
# "has_patent_pending": "on",
"licensing": "reasonable",
"submitter_name": "Test Holder",
"submitter_email": "[email protected]",
}

def test_blanket_disclosure_licensing_restrictions(self):
"""when is_blanket_disclosure is True only royalty-free licensing is valid

Most of the form functionality is tested via the views in IprTests above. More thorough testing
of validation ought to move here so we don't have to exercise the whole Django plumbing repeatedly.
"""
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid())
self.data["is_blanket_disclosure"] = "on"
self.assertFalse(HolderIprDisclosureForm(data=self.data).is_valid())
self.data["licensing"] = "royalty-free"
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid())

def test_patent_details_required_unless_blanket(self):
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid())
patent_fields = ["patent_number", "patent_inventor", "patent_title", "patent_date"]
# any of the fields being missing should invalidate the form
for pf in patent_fields:
val = self.data.pop(pf)
self.assertFalse(HolderIprDisclosureForm(data=self.data).is_valid())
self.data[pf] = val

# should be optional if is_blanket_disclosure is True
self.data["is_blanket_disclosure"] = "on"
self.data["licensing"] = "royalty-free" # also needed for a blanket disclosure
for pf in patent_fields:
val = self.data.pop(pf)
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid())
self.data[pf] = val
2 changes: 1 addition & 1 deletion ietf/ipr/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
url(r'^(?P<id>\d+)/state/$', views.state),
url(r'^update/$', RedirectView.as_view(url=reverse_lazy('ietf.ipr.views.showlist'), permanent=True)),
url(r'^update/(?P<id>\d+)/$', views.update),
url(r'^new-(?P<type>(specific|generic|general|third-party))/$', views.new),
url(r'^new-(?P<_type>(specific|generic|general|third-party))/$', views.new),
url(r'^search/$', views.search),
]
Loading
Loading