diff --git a/changelog b/changelog index 057c9c998..84cd56f22 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,8 @@ ietfdb (2.32) + * Cleaning of IPR disclosure submission form internals + to simplify Django 1.0 transition. From Jelte and Pasi. + * Make WG summary available also with the same name as before (1wg-summary.txt). Fix the template to more closely match the old layout, for screenscraping scripts. diff --git a/ietf/ipr/new.py b/ietf/ipr/new.py index 9733a28a1..1d984e4c6 100644 --- a/ietf/ipr/new.py +++ b/ietf/ipr/new.py @@ -50,12 +50,9 @@ def ipr_contact_form_callback(field, **kwargs): # Classes # ---------------------------------------------------------------- -# Get a form class which renders fields using a given template -CustomForm = ietf.utils.makeFormattingForm(template="ipr/formfield.html") - # Get base form classes for our models -BaseIprForm = forms.form_for_model(models.IprDetail, form=CustomForm, formfield_callback=ipr_detail_form_callback) -BaseContactForm = forms.form_for_model(models.IprContact, form=CustomForm, formfield_callback=ipr_contact_form_callback) +BaseIprForm = forms.form_for_model(models.IprDetail, formfield_callback=ipr_detail_form_callback) +BaseContactForm = forms.form_for_model(models.IprContact, formfield_callback=ipr_contact_form_callback) # Some subclassing: @@ -70,11 +67,6 @@ class ContactForm(BaseContactForm): def add_prefix(self, field_name): return self.prefix and ('%s_%s' % (self.prefix, field_name)) or field_name - def clean(self, *value): - if value: - return self.full_clean() - else: - return self.clean_data # ---------------------------------------------------------------- @@ -101,11 +93,11 @@ def new(request, type, update=None, submitter=None): stdonly_license = forms.BooleanField(required=False) hold_contact_is_submitter = forms.BooleanField(required=False) ietf_contact_is_submitter = forms.BooleanField(required=False) - if "holder_contact" in section_list: + if section_list.get("holder_contact", False): holder_contact = ContactForm(prefix="hold") - if "ietf_contact" in section_list: + if section_list.get("ietf_contact", False): ietf_contact = ContactForm(prefix="ietf") - if "submitter" in section_list: + if section_list.get("submitter", False): submitter = ContactForm(prefix="subm") def __init__(self, *args, **kw): contact_type = {1:"holder_contact", 2:"ietf_contact", 3:"submitter"} @@ -121,8 +113,8 @@ def new(request, type, update=None, submitter=None): kwnoinit = kw.copy() kwnoinit.pop('initial', None) for contact in ["holder_contact", "ietf_contact", "submitter"]: - if contact in section_list: - self.base_fields[contact] = ContactForm(prefix=contact[:4], initial=contact_initial.get(contact, {}), *args, **kwnoinit) + if section_list.get(contact, False): + setattr(self, contact, ContactForm(prefix=contact[:4], initial=contact_initial.get(contact, {}), *args, **kwnoinit)) rfclist_initial = "" if update: rfclist_initial = " ".join(["RFC%d" % rfc.document_id for rfc in update.rfcs.all()]) @@ -131,9 +123,9 @@ def new(request, type, update=None, submitter=None): if update: draftlist_initial = " ".join([draft.document.filename + (draft.revision and "-%s" % draft.revision or "") for draft in update.drafts.all()]) self.base_fields["draftlist"] = forms.CharField(required=False, initial=draftlist_initial) - if "holder_contact" in section_list: + if section_list.get("holder_contact", False): self.base_fields["hold_contact_is_submitter"] = forms.BooleanField(required=False) - if "ietf_contact" in section_list: + if section_list.get("ietf_contact", False): self.base_fields["ietf_contact_is_submitter"] = forms.BooleanField(required=False) self.base_fields["stdonly_license"] = forms.BooleanField(required=False) @@ -187,26 +179,29 @@ def new(request, type, update=None, submitter=None): drafts.append("%s-%s" % (filename, id.revision)) return " ".join(drafts) return "" - def clean_holder_contact(self): - return self.holder_contact.full_clean() - def clean_ietf_contact(self): - return self.ietf_contact.full_clean() - def clean_submitter(self): - return self.submitter.full_clean() def clean_licensing_option(self): licensing_option = self.clean_data['licensing_option'] if section_list.get('licensing', False): if licensing_option in (None, ''): raise forms.ValidationError, 'This field is required.' return licensing_option - + def is_valid(self): + if not BaseIprForm.is_valid(self): + return False + for contact in ["holder_contact", "ietf_contact", "submitter"]: + if hasattr(self, contact) and getattr(self, contact) != None and not getattr(self, contact).is_valid(): + return False + return True # If we're POSTed, but we got passed a submitter, it was the # POST of the "get updater" form, so we don't want to validate # this one. When we're posting *this* form, submitter is None, # even when updating. - if request.method == 'POST' and not submitter: - data = request.POST.copy() + if (request.method == 'POST' or '_testpost' in request.REQUEST) and not submitter: + if request.method == 'POST': + data = request.POST.copy() + else: + data = request.GET.copy() data["submitted_date"] = datetime.now().strftime("%Y-%m-%d") data["third_party"] = section_list["third_party"] data["generic"] = section_list["generic"] @@ -331,10 +326,13 @@ def update(request, ipr_id=None): if not(request.POST.has_key('legal_name')): class UpdateForm(BaseContactForm): def __init__(self, *args, **kwargs): - self.base_fields["update_auth"] = forms.BooleanField("I am authorized to update this IPR disclosure, and I understand that notification of this update will be provided to the submitter of the original IPR disclosure and to the Patent Holder's Contact.") - super(UpdateForm, self).__init__(*args, **kwargs) + super(UpdateForm, self).__init__(*args, **kwargs) + self.fields["update_auth"] = forms.BooleanField() + if request.method == 'POST': form = UpdateForm(request.POST) + elif '_testpost' in request.REQUEST: + form = UpdateForm(request.GET) else: form = UpdateForm() diff --git a/ietf/ipr/testurl.list b/ietf/ipr/testurl.list index 247817647..abafe85a1 100644 --- a/ietf/ipr/testurl.list +++ b/ietf/ipr/testurl.list @@ -11,54 +11,64 @@ 200 /ipr/1129/ # Non-ASCII other fields 200 /ipr/751/ # Updates others, and is updated by others 200 /ipr/765/ # Removed +404 /ipr/1066/ # Test record -200 /ipr/new-generic/ +200 /ipr/new-generic/ 200 /ipr/new-specific/ -200 /ipr/new-third-party/ -200 /ipr/update/ +200 /ipr/new-third-party/ +200 /ipr/new-generic/?_testpost +200 /ipr/new-specific/?_testpost +200 /ipr/new-third-party/?_testpost -#200 /ipr/update/657/ https://datatracker.ietf.org/public/ipr_generic.cgi?command=update_ipr&ipr_id=657 -#200 /ipr/update/820/ https://datatracker.ietf.org/public/ipr_notify.cgi?command=update_ipr&ipr_id=820 -#200 /ipr/update/844/ https://datatracker.ietf.org/public/ipr.cgi?command=update_ipr&ipr_id=844 +200 /ipr/update/ +200 /ipr/update/657/ # Generic +200 /ipr/update/820/ # Third-party +200 /ipr/update/844/ # Specific +404 /ipr/update/1066/ # Removed test record + +200 /ipr/update/657/?_testpost # Generic +200 /ipr/update/820/?_testpost # Third-party +200 /ipr/update/844/?_testpost # Specific +200 /ipr/update/657/?_testpost&email=test@example.com&name=Test&telephone=123&update_auth=on +200 /ipr/update/820/?_testpost&email=test@example.com&name=Test&telephone=123&update_auth=on +200 /ipr/update/844/?_testpost&email=test@example.com&name=Test&telephone=123&update_auth=on 200 /ipr/search/ -#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/?document_search=mod&option=document_search https://datatracker.ietf.org/public/ipr_search.cgi?option=document_search&document_search=mod -#200,sort /ipr/search/?id_document_tag=2220&option=document_search https://datatracker.ietf.org/public/ipr_search.cgi?option=document_search&id_document_tag=2220 -#200,skipredirect /ipr/search/?option=document_search&document_search=draft-housley-tls-authz-extns-05 https://datatracker.ietf.org/ipr/search/?option=document_search&document_search=draft-housley-tls-authz-extns -#200,skipredirect /ipr/search/?option=document_search&document_search=draft-housley-tls-authz-extns-05.txt https://datatracker.ietf.org/ipr/search/?option=document_search&document_search=draft-housley-tls-authz-extns +200 /ipr/search/?document_search=mod&option=document_search # Returns document list +200 /ipr/search/?id_document_tag=2220&option=document_search # Simple case +200 /ipr/search/?id_document_tag=2221&option=document_search # Empty result +200 /ipr/search/?option=document_search&document_search=draft-housley-tls-authz-extns-05 # More complex result -# This takes ~ 300s: -#200,sort /ipr/search/?rfc_search=1034&option=rfc_search https://datatracker.ietf.org/public/ipr_search.cgi?option=rfc_search&rfc_search=1034 # Loong result, RFC search -#200,sort /ipr/search/?rfc_search=1032&option=rfc_search https://datatracker.ietf.org/public/ipr_search.cgi?option=rfc_search&rfc_search=1032 # Loong result, RFC search -#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/search/?rfc_search=1034&option=rfc_search # Loong result +200 /ipr/search/?rfc_search=4555&option=rfc_search # Simple result +200 /ipr/search/?rfc_search=4444&option=rfc_search # Empty result -#200 /ipr/search/?patent_search=nortel&option=patent_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_search&patent_search=nortel -#200 /ipr/search/?patent_search=nortelxz&option=patent_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_search&patent_search=nortelxz # Empty result +200 /ipr/search/?patent_search=nortel&option=patent_search +200 /ipr/search/?patent_search=nortelxz&option=patent_search # Empty result -#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,sort,ignore:quote /ipr/search/?wg_search=aaa&option=wg_search https://datatracker.ietf.org/public/ipr_search.cgi?option=wg_search&wg_search=aaa # FIXME This fails, needs revisiting -#200,sort,ignore:quote /ipr/search/?wg_search=acct&option=wg_search https://datatracker.ietf.org/public/ipr_search.cgi?option=wg_search&wg_search=acct # Empty result +200 /ipr/search/?wg_search=dnsext&option=wg_search +200 /ipr/search/?wg_search=aaa&option=wg_search +200 /ipr/search/?wg_search=acct&option=wg_search # Empty result -#200,sort,ignore:quote /ipr/search/?option=title_search&title_search=AAA https://datatracker.ietf.org/public/ipr_search.cgi?option=title_search&title_search=AAA -#200,sort,ignore:quote /ipr/search/?option=title_search&title_search=AAAxz https://datatracker.ietf.org/public/ipr_search.cgi?option=title_search&title_search=AAAxz # Empty result +200 /ipr/search/?option=title_search&title_search=AAA +200 /ipr/search/?option=title_search&title_search=AAAxz # Empty result -#200,sort /ipr/search/?patent_info_search=123&option=patent_info_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_info_search&patent_info_search=123 -#200,sort /ipr/search/?patent_info_search=31415&option=patent_info_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_info_search&patent_info_search=31415 # Empty result +200 /ipr/search/?patent_info_search=123&option=patent_info_search +200 /ipr/search/?patent_info_search=31415&option=patent_info_search # Empty result +200 /ipr/search/?patent_info_search=12&option=patent_info_search # Error: at least 3 characters +200 /ipr/search/?patent_info_search=abc&option=patent_info_search # Error: at least 1 digit -#200 /ipr/search/?patent_info_search=12&option=patent_info_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_info_search&patent_info_search=12 # Error: at least 3 characters -#200 /ipr/search/?patent_info_search=abc&option=patent_info_search https://datatracker.ietf.org/public/ipr_search.cgi?option=patent_info_search&patent_info_search=abc # Error: at least 1 digit - -#200 /ipr/search/?option=ipr_title_search&ipr_title_search=nortel https://datatracker.ietf.org/public/ipr_search.cgi?option=ipr_title_search&ipr_title_search=nortel -#200 /ipr/search/?option=ipr_title_search&ipr_title_search=nortelxz https://datatracker.ietf.org/public/ipr_search.cgi?option=ipr_title_search&ipr_title_search=nortelxz # Empty result +200 /ipr/search/?option=ipr_title_search&ipr_title_search=nortel +200 /ipr/search/?option=ipr_title_search&ipr_title_search=nortelxz # Empty result -200 /ipr/about/ -200 /ipr/by-draft/ -200 /ipr/by-date/ -#200 /ipr/y/2006/ -#200 /ipr/y/2006/feb/ +200 /ipr/about/ +200 /ipr/by-draft/ +200 /ipr/by-date/ +#200 /ipr/y/2006/ +#200 /ipr/y/2006/feb/ 200 /feed/ipr/ 200 /sitemap-ipr.xml diff --git a/ietf/templates/ipr/details.html b/ietf/templates/ipr/details.html index ccf8f3b75..9da9b2483 100644 --- a/ietf/templates/ipr/details.html +++ b/ietf/templates/ipr/details.html @@ -22,11 +22,6 @@
{% endif %} - {% ifnotequal ipr.status 1 %} - - This IPR disclosure was {{ ipr.get_status_display }}
-
- {% endifnotequal %} {% if section_list.legacy_intro %} This IPR disclosure was submitted by e-mail.
diff --git a/ietf/templates/ipr/details_edit.html b/ietf/templates/ipr/details_edit.html index 7b6a03004..ed62773bb 100644 --- a/ietf/templates/ipr/details_edit.html +++ b/ietf/templates/ipr/details_edit.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {# Copyright The IETF Trust 2007, All Rights Reserved #} - +{% load ietf_filters %} {% block title %}IPR Details - {{ ipr.title }}{% endblock %} {% block body_attributes %} {% if section_list.holder_contact %}onload="toggle_submitter_info('holder')"{% endif %} @@ -22,11 +22,6 @@
{% endif %} - {% ifnotequal ipr.status 1 %} - - This IPR disclosure was {{ ipr.get_status_display }}
-
- {% endifnotequal %} {% if section_list.legacy_intro %} This IPR disclosure was submitted by e-mail.
@@ -172,11 +167,9 @@

{% endif %} - {% if section_list.form_legend %}

Fields marked with * are required.

- {% endif %} {% if section_list.holder %} @@ -191,7 +184,7 @@ {% block section1_data %} - Legal Name: {{ ipr.legal_name }} + Legal Name: {{ ipr.legal_name.errors }} * {{ ipr.legal_name }} {% endblock %} @@ -207,19 +200,15 @@ Patent Holder's Contact for License Application - Name: {{ ipr.holder_contact.name }} - Title: {{ ipr.holder_contact.title }} - Department: {{ ipr.holder_contact.department }} - Address1: {{ ipr.holder_contact.address1 }} - Address2: {{ ipr.holder_contact.address2 }} - Telephone: {{ ipr.holder_contact.telephone }} - Fax: {{ ipr.holder_contact.fax }} - Email: {{ ipr.holder_contact.email }} + {% for field in ipr.holder_contact %} + {% ifnotequal field.name "update_auth" %} + {{field.label }}:{{ field.errors }} {% if field.field.required %}*{%endif%} {{ field }} + {% endifnotequal %} + {% endfor %} {% endif %} - {% if section_list.ietf_contact %}
@@ -229,18 +218,11 @@ Contact Information for the IETF Participant Whose Personal Belief Triggered this Disclosure: - {% if ipr.ietf_contact.name %} - - - - - - - - - {% else %} - - {% endif %} + {% for field in ipr.ietf_contact %} + {% ifnotequal field.name "update_auth" %} + + {% endifnotequal %} + {% endfor %}
Name: {{ ipr.ietf_contact.name }}
Title: {{ ipr.ietf_contact.title }}
Department: {{ ipr.ietf_contact.department }}
Address1: {{ ipr.ietf_contact.address1 }}
Address2: {{ ipr.ietf_contact.address2 }}
Telephone: {{ ipr.ietf_contact.telephone }}
Fax: {{ ipr.ietf_contact.fax }}
Email: {{ ipr.ietf_contact.email }}
No information submitted
{{field.label }}:{{ field.errors }} {% if field.field.required %}*{%endif%} {{ field }}
{% endif %} @@ -251,28 +233,14 @@ - {% if ipr.rfclist %} - - {% else %} - {% for doc in ipr.rfcs.all %} - - {% endfor %} - {% endif %} - {% if ipr.draftlist %} - - {% else %} - {% for doc in ipr.drafts.all %} - - {% endfor %} - {% endif %} - {% if ipr.other_designations %} - - {% endif %} + + +
- {% if section_list.form_legend %}*{% endif %} + * {% cycle section %}. IETF Document or Other Contribution to Which this IPR Disclosure Relates:
RFC Numbers:{{ ipr.rfclist }}
RFC {{ doc.document.rfc_number }}:"{{ doc.document.title }}"
I-D Filenames (draft-...):{{ ipr.draftlist }}
Internet-Draft:"{{ doc.document.title }}"
({{ doc.document.filename }}-{{ doc.document.revision }})
Designations for Other Contributions:{{ ipr.other_designations }}
RFC Numbers:{{ ipr.rfclist.errors }} {{ ipr.rfclist }}
I-D Filenames (draft-...):{{ ipr.draftlist.errors}} {{ ipr.draftlist }}
Designations for Other Contributions:{{ ipr.other_designations.errors }} {{ ipr.other_designations }}
{% endif %} @@ -283,7 +251,6 @@ {% cycle section %}. - {% if section_list.form_legend %} {% if section_list.generic %} Disclosure of Patent Information (i.e., patents or patent applications required to be disclosed by Section 6 of RFC3979) @@ -296,10 +263,6 @@ Disclosure of Patent Information, if known (i.e., patents or patent applications required to be disclosed by Section 6 of RFC3979) {% endif %} - {% else %} - Disclosure of Patent Information (i.e., patents or patent - applications required to be disclosed by Section 6 of RFC 3979) - {% endif %} {% if ipr.patents or ipr.notes %} @@ -310,19 +273,15 @@ please provide the following information: Patent, Serial, Publication, Registration, - or Application/File number(s): {{ ipr.patents }} + or Application/File number(s): {{ ipr.patents.errors }} * {{ ipr.patents }} - Date(s) granted or applied for: {{ ipr.date_applied }} - Country: {{ ipr.country }} - Additional Notes: {{ ipr.notes }} + Date(s) granted or applied for: {{ ipr.date_applied.errors }} * {{ ipr.date_applied }} + Country: {{ ipr.country.errors }} * {{ ipr.country }} + Additional Notes: {{ ipr.notes.errors }} {{ ipr.notes }} - {% if section_list.form_legend %} B. Does your disclosure relate to an unpublished pending patent application?: - {% else %} - B. Does this disclosure relate to an unpublished pending patent application?: - {% endif %} - {{ ipr.is_pending }} + {{ ipr.is_pending.errors }} {{ ipr.is_pending }} @@ -331,7 +290,7 @@ C. Does this disclosure apply to all IPR owned by the submitter?: - {{ ipr.applies_to_all }} + {{ ipr.applies_to_all.errors }} {{ ipr.applies_to_all }} {% else %} @@ -346,7 +305,7 @@ {% if ipr.document_sections %} - {{ ipr.document_sections }} + {{ ipr.document_sections.errors }} {{ ipr.document_sections }} {% else %} No information submitted {% endif %} @@ -374,7 +333,6 @@ - {% if section_list.form_legend %} {% if section_list.generic %} The Patent Holder states that its position with respect to licensing any patent claims contained in the patent(s) or patent @@ -399,46 +357,33 @@ ("Necessary Patent Claims"), for the purpose of implementing such specification, is as follows(select one licensing declaration option only): {% endif %} - {% else %} - The Patent Holder states that its position with respect - to licensing any patent claims contained in the patent(s) or patent - application(s) disclosed above that would necessarily be infringed by - implementation of the technology required by the relevant IETF specification - ("Necessary Patent Claims"), for the purpose of implementing such - specification, is as follows(select one licensing declaration option only): - {% endif %} - {{ ipr.licensing_option }} + {{ ipr.licensing_option.errors }} {{ ipr.licensing_option }} - {% if ipr.stdonly_license %} - + {{ ipr.stdonly_license.errors }} {{ ipr.stdonly_license }} Above licensing declaration is limited solely to standards-track IETF documents. - {% endif %} Licensing information, comments, notes, or URL for further information: - {% if ipr.comments %} - {{ ipr.comments }} - {% else %} - No information submitted - {% endif %} + {{ ipr.comments.errors }} {{ ipr.comments }} {% if ipr.lic_checkbox %}

+ {{ ipr.lic_checkbox.errors }} {% ifnotequal ipr.lic_checkbox 1 %}{{ ipr.lic_checkbox }}{% endifnotequal %} The individual submitting this template represents and warrants that all terms and conditions that must be satisfied for implementers of any @@ -481,7 +426,6 @@ Contact Information above) - {% if ipr.submitter.name %} {% if ipr.ietf_contact_is_submitter %} {% if section_list.holder_contact %} @@ -502,17 +446,11 @@ {% endif %} {% endif %} - Name: {{ ipr.submitter.name }} - Title: {{ ipr.submitter.title }} - Department: {{ ipr.submitter.department }} - Address1: {{ ipr.submitter.address1 }} - Address2: {{ ipr.submitter.address2 }} - Telephone: {{ ipr.submitter.telephone }} - Fax: {{ ipr.submitter.fax }} - Email: {{ ipr.submitter.email }} - {% else %} - No information submitted - {% endif %} + {% for field in ipr.submitter %} + {% ifnotequal field.name "update_auth" %} + {{field.label }}:{{ field.errors }} {% if field.field.required %}*{%endif%} {{ field }} + {% endifnotequal %} + {% endfor %} {% endif %} @@ -527,27 +465,11 @@ Other Notes: - {% if ipr.other_notes %} - {{ ipr.other_notes }} - {% else %} - No information submitted - {% endif %} + {{ ipr.other_notes.errors }} {{ ipr.other_notes }} {% endif %} - {% comment %} (doesn't work -- commented out for now) - {% if ipr.legacy_url_0 %} -

-

The text of the original IPR declaration:

- -
- {% endif %} - {% endcomment %} - - {% if section_list.form_submit %}
@@ -555,6 +477,5 @@ IPR Disclosure Page
View IPR Disclosures

- {% endif %} {% endblock %} diff --git a/ietf/templates/ipr/formfield.html b/ietf/templates/ipr/formfield.html deleted file mode 100644 index d12d66707..000000000 --- a/ietf/templates/ipr/formfield.html +++ /dev/null @@ -1,10 +0,0 @@ -{# Copyright The IETF Trust 2007, All Rights Reserved #} - {% if errors %} - - {% endif %} - {% if field.required %}*{% endif %}{{ text }} - {{ help_text }} \ No newline at end of file diff --git a/ietf/templates/ipr/update.html b/ietf/templates/ipr/update.html index aee1140c3..396e4060a 100644 --- a/ietf/templates/ipr/update.html +++ b/ietf/templates/ipr/update.html @@ -27,17 +27,16 @@ Contact Information for Submitter of this Update. - Name: {{ form.name }} - Title: {{ form.title }} - Department: {{ form.department }} - Address1: {{ form.address1 }} - Address2: {{ form.address2 }} - Telephone: {{ form.telephone }} - Fax: {{ form.fax }} - Email: {{ form.email }} + {% for field in form %} + {% ifnotequal field.name "update_auth" %} + {{field.label }}:{{ field.errors }} {% if field.field.required %}*{%endif%} {{ field }} + {% endifnotequal %} + {% endfor %}

+ {{ form.update_auth.errors }} + * {{ form.update_auth }} I am authorized to update this IPR disclosure, and I understand that notification of this update will be provided to the submitter of the original IPR disclosure and to the Patent Holder's Contact.

diff --git a/ietf/utils/__init__.py b/ietf/utils/__init__.py index 60efa910b..02365bfcc 100644 --- a/ietf/utils/__init__.py +++ b/ietf/utils/__init__.py @@ -6,10 +6,6 @@ from cache_foreign_key import FKAsOneToOne from soup2text import TextSoup, soup2text from draft_search import normalize_draftname -# DJANGO_096: needs to be removed -from templated_form import makeTemplatedForm -makeFormattingForm = makeTemplatedForm - # See http://docs.python.org/tut/node8.html regarding the use of __all__ and # also regarding the practice of using "from xxx import *" in interactive # sessions vs. in source files. diff --git a/ietf/utils/templated_form.py b/ietf/utils/templated_form.py deleted file mode 100644 index 54e9c9073..000000000 --- a/ietf/utils/templated_form.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright The IETF Trust 2007, All Rights Reserved - -from django.utils.html import escape - -def makeTemplatedForm(template=None): - """Create a form class which formats its fields using the provided template - - The template is provided with a dictionary containing the following key-value - pairs: - - "label": field label, if any, - "errors": list of errors, if any, - "text": widget rendering for an unbound form / field value for a bound form, - "help_text": field help text, if any - """ - from django.template import loader - import django.newforms as forms - - class TemplatedForm(forms.BaseForm): - _template = template - def __getitem__(self, name): - "Returns a rendered field with the given name." - #syslog.syslog("FormattingForm.__getitem__(%s)" % (name, )) - try: - field = self.fields[name] - except KeyError: - raise KeyError('Key %r not found in Form' % name) - if not isinstance(field, forms.fields.Field): - return field - bf = forms.forms.BoundField(self, field, name) - errors = [escape(error) for error in bf.errors] - rendering = loader.render_to_string(self._template, { "errors": errors, "label": bf.label, "text": unicode(bf), "help_text": field.help_text, "field":field }) - return rendering - return TemplatedForm