Fix the RFC number doc.note migration to catch combined "RFC XXX; BCP
XXX" notes too, use the opportunity to remove inserted HTML tags from notes and rely on linebreaksbr filter instead (the other thing was a left-over from the Perl days), update the various uses of the note to reflect that - Legacy-Id: 5289
This commit is contained in:
parent
188c619635
commit
ce081cb31d
|
@ -7,14 +7,24 @@ from django.db import models
|
|||
class Migration(DataMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# whack obsolete RFC 1234 notes (obsolete now that we got RFC alias links set up properly)
|
||||
for d in orm.Document.objects.filter(type="draft").exclude(note="").iterator():
|
||||
if re.match("^RFC\s*\d+$", d.note):
|
||||
# there are a couple that match without a
|
||||
# corresponding RFC DocAlias, but upon manual
|
||||
# inspection these all turn out to be mistakes in the
|
||||
# note (most are off-by-one in the RFC number)
|
||||
note = re.sub("^RFC\s*\d+$", "", d.note).strip()
|
||||
note = d.note
|
||||
|
||||
# get rid of HTML garbage
|
||||
note = note.replace("\r", "")
|
||||
note = note.replace("<br>", "\n")
|
||||
note = note.replace(" ", " ")
|
||||
note = note.strip()
|
||||
|
||||
# whack obsolete RFC/BCP/STD 1234 notes (obsolete now that
|
||||
# we got RFC alias links set up properly),
|
||||
# there are a couple that match without a
|
||||
# corresponding RFC DocAlias, but upon manual
|
||||
# inspection these all turn out to be mistakes in the
|
||||
# note (most are off-by-one in the RFC number)
|
||||
note = re.sub("^((STD|BCP|RFC)\s*#?\d+[\s,;]*)+", "", note).strip()
|
||||
|
||||
if note != d.note:
|
||||
orm.Document.objects.filter(name=d.name).update(note=note)
|
||||
|
||||
def backwards(self, orm):
|
|
@ -380,8 +380,7 @@ class EditInfoFormREDESIGN(forms.Form):
|
|||
self.standard_fields = [x for x in self.visible_fields() if x.name not in ('returning_item',)]
|
||||
|
||||
def clean_note(self):
|
||||
# note is stored munged in the database
|
||||
return self.cleaned_data['note'].replace('\n', '<br>').replace('\r', '').replace(' ', ' ')
|
||||
return self.cleaned_data['note'].replace('\r', '').strip()
|
||||
|
||||
|
||||
def get_initial_notify(doc):
|
||||
|
@ -516,7 +515,7 @@ def edit_infoREDESIGN(request, name):
|
|||
area=doc.group_id,
|
||||
ad=doc.ad_id,
|
||||
notify=doc.notify,
|
||||
note=dehtmlify_textarea_text(doc.note),
|
||||
note=doc.note,
|
||||
telechat_date=initial_telechat_date,
|
||||
returning_item=initial_returning_item,
|
||||
)
|
||||
|
@ -811,15 +810,14 @@ class IESGNoteForm(forms.Form):
|
|||
note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False)
|
||||
|
||||
def clean_note(self):
|
||||
# note is stored munged in the database
|
||||
return self.cleaned_data['note'].replace('\n', '<br>').replace('\r', '').replace(' ', ' ')
|
||||
return self.cleaned_data['note'].replace('\r', '').strip()
|
||||
|
||||
@group_required("Area Director", "Secretariat")
|
||||
def edit_iesg_note(request, name):
|
||||
doc = get_object_or_404(Document, type="draft", name=name)
|
||||
login = request.user.get_profile()
|
||||
|
||||
initial = dict(note=dehtmlify_textarea_text(doc.note))
|
||||
initial = dict(note=doc.note)
|
||||
|
||||
if request.method == "POST":
|
||||
form = IESGNoteForm(request.POST, initial=initial)
|
||||
|
|
|
@ -229,9 +229,6 @@ def agenda_docs(date, next_agenda):
|
|||
section_key = "s"+get_doc_section(id)
|
||||
if section_key not in res:
|
||||
res[section_key] = []
|
||||
if id.note:
|
||||
# TODO: Find out why this is _here_
|
||||
id.note = id.note.replace(u"\240",u" ")
|
||||
res[section_key].append({'obj':id})
|
||||
return res
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
<td>IESG Note:</td>
|
||||
<td>
|
||||
<a {% if can_edit %}class="editlink" href="{% url doc_change_iesg_note name=doc.name %}"{% endif %}>
|
||||
{{ doc.note|default:"(None)"|format_textarea|safe }}
|
||||
{{ doc.note|default:"(None)"|linebreaksbr }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
{% if doc.primary_flag %}
|
||||
<tr><td></td><td>Token:</td><td><a href="mailto:{{ doc.token_email|urlencode }}">{{ doc.token_name }}</a></td></tr>
|
||||
{% if doc.note %}
|
||||
<tr><td></td><td>Note:</td><td>{{ doc.note|safe|urlize }}</td></tr>
|
||||
<tr><td></td><td>Note:</td><td>{{ doc.note|linebreaksbr|urlize }}</td></tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -83,7 +83,7 @@ Some parts Copyright (c) 2009 The IETF Trust, all rights reserved.
|
|||
<a href="http://www.ietf.org/id/{{doc.obj.conflictdoc.name}}-{{doc.obj.conflictdoc.rev}}.txt">[txt]</a>
|
||||
<br/>{{ doc.obj.conflictdoc.title|escape }} ({{doc.obj.conflictdoc.stream}}: {{ doc.obj.conflictdoc.intended_std_level }})
|
||||
{% if doc.obj.conflictdoc.note %}
|
||||
<br/>Note: {{ doc.obj.conflictdoc.note|unescape }}
|
||||
<br/>Note: {{ doc.obj.conflictdoc.note|linebreaksbr }}
|
||||
{% endif %}
|
||||
|
||||
{% if doc.obj.conflictdoc.ipr %}
|
||||
|
|
|
@ -77,7 +77,7 @@ Some parts Copyright (c) 2009 The IETF Trust, all rights reserved.
|
|||
|
||||
|
||||
{% if doc.obj.note %}
|
||||
<br/>Note: {{ doc.obj.note|unescape }}
|
||||
<br/>Note: {{ doc.obj.note|linebreaksbr }}
|
||||
{% endif %}
|
||||
|
||||
{% if doc.obj.ipr %}
|
||||
|
|
|
@ -51,8 +51,8 @@ Some parts Copyright (c) 2009 The IETF Trust, all rights reserved.
|
|||
{{ doc.obj.conflictdoc.title|escape }} ({{doc.obj.conflictdoc.stream}}: {{ doc.obj.conflictdoc.intended_std_level }})
|
||||
<br><a href="{% url doc_view name=doc.obj.conflictdoc.canonical_name %}">{{doc.obj.conflictdoc.canonical_name}}</a>
|
||||
<a href="http://www.ietf.org/id/{{doc.obj.conflictdoc.canonical_name}}-{{doc.obj.conflictdoc.rev}}.txt">[txt]</a>
|
||||
{% if doc.obj.conflictdoc.note %}{# note: note is not escaped #}
|
||||
<br>Note: {{ doc.obj.conflictdoc.note|safe }}
|
||||
{% if doc.obj.conflictdoc.note %}
|
||||
<br>Note: {{ doc.obj.conflictdoc.note|linebreaksbr }}
|
||||
{% endif %}
|
||||
{% for ipr in doc.obj.conflictdoc.ipr %}
|
||||
{% ifequal ipr.ipr.status 1 %}
|
||||
|
|
|
@ -55,7 +55,7 @@ Some parts Copyright (c) 2009 The IETF Trust, all rights reserved.
|
|||
{% endwith %}
|
||||
<br>Token: {{ doc.obj.ad.plain_name|escape }} ({{doc.obj.area_acronym}} area)
|
||||
{% if doc.obj.note %}
|
||||
<br>Note: {{ doc.obj.note }}
|
||||
<br>Note: {{ doc.obj.note|linebreaksbr }}
|
||||
{% endif %}
|
||||
{% for ipr in doc.obj.ipr %}
|
||||
{% ifequal ipr.ipr.status 1 %}
|
||||
|
|
Loading…
Reference in a new issue