Skip to content

Commit 44f42cd

Browse files
committed
Undid the previous commit
- Legacy-Id: 16735
1 parent e3e9f67 commit 44f42cd

File tree

8 files changed

+46
-87
lines changed

8 files changed

+46
-87
lines changed

changelog

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
ietfdb (6.101.1) ietf; urgency=medium
2-
3-
* Added a link from the datatracker RFC pages to the new RFC rendereings
4-
with inline errata on the RFC-Editor webpage (where available).
5-
6-
* Updated rfc-editor sync code to recognize the new Tooling Issue queue
7-
state.
8-
9-
* Updated ietf.sync.rfceditor.parse_index() to use the new rfc-index
10-
schema (changed placement of the page-count element).
11-
12-
* Added code to catch a form error regularly caused by form spam and
13-
return a failure instead of triggering a server 500.
14-
15-
-- Henrik Levkowetz <henrik@levkowetz.com> 15 Sep 2019 11:35:29 +0000
16-
17-
181
ietfdb (6.101.0) ietf; urgency=medium
192

203
**IANA expert review tracking, new constraints labelling**

ietf/doc/views_doc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def document_main(request, name, rev=None):
206206

207207
# file types
208208
base_path = os.path.join(settings.RFC_PATH, name + ".")
209-
possible_types = settings.RFC_FILE_TYPES
209+
possible_types = ["txt", "pdf", "ps"]
210210
found_types = [t for t in possible_types if os.path.exists(base_path + t)]
211211

212212
base = "https://www.rfc-editor.org/rfc/"
@@ -220,7 +220,7 @@ def document_main(request, name, rev=None):
220220
file_urls.append(("pdf", base + "pdfrfc/" + name + ".txt.pdf"))
221221

222222
if "txt" in found_types:
223-
file_urls.append(("htmlized", settings.TOOLS_ID_HTML_URL + name))
223+
file_urls.append(("html", settings.TOOLS_ID_HTML_URL + name))
224224
if doc.tags.filter(slug="errata"):
225225
file_urls.append(("with errata", settings.RFC_EDITOR_INLINE_ERRATA_URL.format(rfc_number=rfc_number)))
226226

@@ -236,8 +236,8 @@ def document_main(request, name, rev=None):
236236

237237
# file types
238238
base_path = os.path.join(settings.INTERNET_DRAFT_PATH, doc.name + "-" + doc.rev + ".")
239-
possible_types = settings.IDSUBMIT_FILE_TYPES
240-
found_types = [t for t in possible_types if os.path.exists(base_path + t)]
239+
possible_types = ["pdf", "xml", "ps"]
240+
found_types = ["txt"] + [t for t in possible_types if os.path.exists(base_path + t)]
241241

242242
if not snapshot and doc.get_state_slug() == "active":
243243
base = settings.IETF_ID_URL
@@ -251,7 +251,7 @@ def document_main(request, name, rev=None):
251251

252252
if "pdf" not in found_types:
253253
file_urls.append(("pdf", settings.TOOLS_ID_PDF_URL + doc.name + "-" + doc.rev + ".pdf"))
254-
file_urls.append(("htmlized", settings.TOOLS_ID_HTML_URL + doc.name + "-" + doc.rev))
254+
file_urls.append(("html", settings.TOOLS_ID_HTML_URL + doc.name + "-" + doc.rev))
255255

256256
# latest revision
257257
latest_revision = doc.latest_event(NewRevisionDocEvent, type="new_revision")

ietf/settings.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -780,20 +780,15 @@ def skip_unreadable_post(record):
780780

781781
IDSUBMIT_MANUAL_STAGING_DIR = '/tmp/'
782782

783-
784783
IDSUBMIT_FILE_TYPES = (
785784
'txt',
786-
'html',
787785
'xml',
788786
'pdf',
789787
'ps',
790788
)
791-
RFC_FILE_TYPES = IDSUBMIT_FILE_TYPES
792-
793789
IDSUBMIT_MAX_DRAFT_SIZE = {
794790
'txt': 2*1024*1024, # Max size of txt draft file in bytes
795791
'xml': 3*1024*1024, # Max size of xml draft file in bytes
796-
'html': 4*1024*1024,
797792
'pdf': 6*1024*1024,
798793
'ps' : 6*1024*1024,
799794
}

ietf/submit/forms.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,12 @@ def deduce_group(self):
352352
class SubmissionManualUploadForm(SubmissionBaseUploadForm):
353353
xml = forms.FileField(label='.xml format', required=False) # xml field with required=False instead of True
354354
txt = forms.FileField(label='.txt format', required=False)
355-
# We won't permit html upload until we can verify that the content
356-
# reasonably matches the text and/or xml upload:
357-
# html = forms.FileField(label='.html format', required=False)
358355
pdf = forms.FileField(label='.pdf format', required=False)
359356
ps = forms.FileField(label='.ps format', required=False)
360357

361358
def __init__(self, request, *args, **kwargs):
362359
super(SubmissionManualUploadForm, self).__init__(request, *args, **kwargs)
363-
self.formats = settings.IDSUBMIT_FILE_TYPES
360+
self.formats = ['txt', 'pdf', 'xml', 'ps', ]
364361
self.base_formats = ['txt', 'xml', ]
365362

366363
def clean_txt(self):

ietf/submit/test_submission.xml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" []>
33
<?rfc toc="yes"?>
4-
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="info" docName="%(name)s" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" xml:lang="en" version="3">
5-
<!-- xml2rfc v2v3 conversion 2.29.1 -->
4+
<rfc category="info" docName="%(name)s" ipr="trust200902">
65
<front>
76
<title>%(title)s</title>
8-
<seriesInfo name="Internet-Draft" value="%(name)s"/>
97
<author fullname="%(author)s" initials="%(initials)s" surname="%(surname)s">
108
<organization>Test Centre Inc.</organization>
9+
1110
<address>
1211
<postal>
1312
<street>42 Some Road</street>
@@ -17,24 +16,26 @@
1716
<email>%(email)s</email>
1817
</address>
1918
</author>
20-
<date day="%(day)s" month="%(month)s" year="%(year)s"/>
19+
<date month="%(month)s" year="%(year)s" />
2120
<workgroup>%(group)s</workgroup>
2221
<abstract>
2322
<t>
2423
This document describes how to test tests.
2524
</t>
2625
</abstract>
2726
</front>
27+
2828
<middle>
29-
<section numbered="true" toc="default">
30-
<name>Introduction</name>
29+
<section title="Introduction">
3130
<t>
3231
This document describes a protocol for testing tests.
3332
</t>
3433
</section>
35-
<section numbered="true" toc="default">
36-
<name>Yang</name>
37-
<sourcecode name="ietf-yang-metadata@2016-08-05.yang" type="" markers="true"><![CDATA[
34+
<section title="Yang">
35+
<figure>
36+
<artwork>
37+
<![CDATA[
38+
<CODE BEGINS> file "ietf-yang-metadata@2016-08-05.yang"
3839
3940
module ietf-yang-metadata {
4041
@@ -121,10 +122,13 @@ module ietf-yang-metadata {
121122
}
122123
}
123124
124-
]]></sourcecode>
125+
<CODE ENDS>
126+
]]>
127+
</artwork>
128+
</figure>
125129
</section>
126-
<section anchor="JSON" numbered="true" toc="default">
127-
<name>JSON example</name>
130+
131+
<section anchor="JSON" title="JSON example">
128132
<t>
129133
The JSON object should look like this:
130134

@@ -133,18 +137,17 @@ module ietf-yang-metadata {
133137
}
134138
</t>
135139
</section>
136-
<section anchor="Security" numbered="true" toc="default">
137-
<name>Security Considerations</name>
140+
<section anchor="Security" title="Security Considerations">
138141
<t>
139142
There are none.
140143
</t>
141144
</section>
142-
<section anchor="IANA" numbered="true" toc="default">
143-
<name>IANA Considerations</name>
145+
<section anchor="IANA" title="IANA Considerations">
144146
<t>
145147
No new registrations for IANA.
146148
</t>
147149
</section>
148150
</middle>
149-
<back/>
151+
<back>
152+
</back>
150153
</rfc>

ietf/submit/tests.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def submission_file(name, rev, group, format, templatename, author=None, email=N
6464
expiration=(datetime.date.today() + datetime.timedelta(days=100)).strftime("%d %B, %Y"),
6565
year=year,
6666
month=datetime.date.today().strftime("%B"),
67-
day=datetime.date.today().strftime("%d"),
6867
name="%s-%s" % (name, rev),
6968
group=group or "",
7069
author=author.ascii if ascii else author.name,
@@ -152,8 +151,6 @@ def do_submission(self, name, rev, group=None, formats=["txt",], author=None):
152151
status_url = r["Location"]
153152
for format in formats:
154153
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, "%s-%s.%s" % (name, rev, format))))
155-
if format == 'xml':
156-
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, "%s-%s.%s" % (name, rev, 'html'))))
157154
self.assertEqual(Submission.objects.filter(name=name).count(), 1)
158155
submission = Submission.objects.get(name=name)
159156
if len(submission.authors) != 1:
@@ -1687,7 +1684,7 @@ def test_api_submit_no_title(self):
16871684
self.assertContains(r, expected, status_code=400)
16881685

16891686
def test_api_submit_failed_idnits(self):
1690-
r, author, name = self.post_submission('00', year="2010")
1687+
r, author, name = self.post_submission('00', year="1900")
16911688
expected = "Document date must be within 3 days of submission date"
16921689
self.assertContains(r, expected, status_code=400)
16931690

ietf/submit/utils.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,16 @@ def cancel_submission(submission):
528528
remove_submission_files(submission)
529529

530530
def rename_submission_files(submission, prev_rev, new_rev):
531-
for ext in settings.IDSUBMIT_FILE_TYPES:
531+
from ietf.submit.forms import SubmissionManualUploadForm
532+
for ext in list(SubmissionManualUploadForm.base_fields.keys()):
532533
source = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s.%s' % (submission.name, prev_rev, ext))
533534
dest = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s.%s' % (submission.name, new_rev, ext))
534535
if os.path.exists(source):
535536
os.rename(source, dest)
536537

537538
def move_files_to_repository(submission):
538-
for ext in settings.IDSUBMIT_FILE_TYPES:
539+
from ietf.submit.forms import SubmissionManualUploadForm
540+
for ext in list(SubmissionManualUploadForm.base_fields.keys()):
539541
source = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s.%s' % (submission.name, submission.rev, ext))
540542
dest = os.path.join(settings.IDSUBMIT_REPOSITORY_PATH, '%s-%s.%s' % (submission.name, submission.rev, ext))
541543
if os.path.exists(source):
@@ -621,21 +623,17 @@ def get_draft_meta(form, saved_files):
621623
abstract = None
622624
file_size = None
623625
if form.cleaned_data['xml']:
624-
try:
625-
xmlroot = form.xmltree.getroot()
626-
xml_version = xmlroot.get('version', '2')
627-
if xml_version == '3':
628-
prep = xml2rfc.PrepToolWriter(form.xmltree, quiet=True)
629-
form.xmltree.tree = prep.prep()
630-
except Exception as e:
631-
raise ValidationError("Error from xml2rfc: %s" % e)
632626
if not ('txt' in form.cleaned_data and form.cleaned_data['txt']):
633627
file_name['txt'] = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s.txt' % (form.filename, form.revision))
634628
try:
629+
xmlroot = form.xmltree.getroot()
630+
xml_version = xmlroot.get('version', '2')
635631
if xml_version != '3':
636632
pagedwriter = xml2rfc.PaginatedTextRfcWriter(form.xmltree, quiet=True)
637633
pagedwriter.write(file_name['txt'])
638634
else:
635+
prep = xml2rfc.PrepToolWriter(form.xmltree, quiet=True)
636+
form.xmltree.tree = prep.prep()
639637
writer = xml2rfc.TextWriter(form.xmltree, quiet=True)
640638
writer.write(file_name['txt'])
641639
log.log("In %s: xml2rfc %s generated %s from %s (version %s)" %
@@ -647,20 +645,6 @@ def get_draft_meta(form, saved_files):
647645
except Exception as e:
648646
raise ValidationError("Error from xml2rfc: %s" % e)
649647
file_size = os.stat(file_name['txt']).st_size
650-
try:
651-
if xml_version == '3':
652-
file_name['html'] = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s.html' % (form.filename, form.revision))
653-
writer = xml2rfc.HtmlWriter(form.xmltree, quiet=True)
654-
writer.write(file_name['html'])
655-
form.file_types.append('.html')
656-
log.log("In %s: xml2rfc %s generated %s from %s (version %s)" %
657-
( os.path.dirname(file_name['xml']),
658-
xml2rfc.__version__,
659-
os.path.basename(file_name['html']),
660-
os.path.basename(file_name['xml']),
661-
xml_version))
662-
except Exception as e:
663-
raise ValidationError("Error from xml2rfc: %s" % e)
664648
# Some meta-information, such as the page-count, can only
665649
# be retrieved from the generated text file. Provide a
666650
# parsed draft object to get at that kind of information.

ietf/templates/submit/submission_status.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ <h2>Meta-data from the submission</h2>
152152
{% show_submission_files submission %}
153153

154154
{% if errors.files %}
155-
<p class="text-danger bg-danger"><b>{{ errors.files|safe }}</b></p>
155+
<p class="text-danger"><b>{{ errors.files|safe }}</b></p>
156156
{% endif %}
157157
</td>
158158
</tr>
@@ -164,7 +164,7 @@ <h2>Meta-data from the submission</h2>
164164

165165
{% if errors.rev %}
166166
<button class="btn btn-default btn-xs pull-right" data-toggle="modal" data-target="#twopages">View errors in document</button>
167-
<p class="text-danger bg-danger"><b>{{ errors.rev }}</b></p>
167+
<p class="text-danger"><b>{{ errors.rev }}</b></p>
168168
{% endif %}
169169
</td>
170170
</tr>
@@ -174,7 +174,7 @@ <h2>Meta-data from the submission</h2>
174174
<td>
175175
{{ submission.group|default:"Individual Submission" }}
176176
{% if errors.group %}
177-
<p class="text-danger bg-danger"><b>{{ errors.group }}</b></p>
177+
<p class="text-danger"><b>{{ errors.group }}</b></p>
178178
{% endif %}
179179
</td>
180180
</tr>
@@ -184,7 +184,7 @@ <h2>Meta-data from the submission</h2>
184184
<td>
185185
{{ submission.document_date }}
186186
{% if errors.document_date %}
187-
<p class="text-danger bg-danger"><b>{{ errors.document_date }}</b></p>
187+
<p class="text-danger"><b>{{ errors.document_date }}</b></p>
188188
{% endif %}
189189
</td>
190190
</tr>
@@ -198,15 +198,15 @@ <h2>Meta-data from the submission</h2>
198198
<th>Title</th>
199199
<td>
200200
{{ submission.title|default:"" }}
201-
{% if errors.title %}<p class="text-danger bg-danger"><b>{{ errors.title }}</b></p>{% endif %}
201+
{% if errors.title %}<p class="text-danger"><b>{{ errors.title }}</b></p>{% endif %}
202202
</td>
203203
</tr>
204204

205205
<tr>
206206
<th>Authors</th>
207207
<td>
208208
{{ submission.authors|length }} author{{ submission.authors|pluralize }}
209-
{% if errors.authors %}<p class="text-danger bg-danger"><b>{{ errors.authors|safe }}</b></p>{% endif %}
209+
{% if errors.authors %}<p class="text-danger"><b>{{ errors.authors|safe }}</b></p>{% endif %}
210210
</td>
211211
</tr>
212212

@@ -244,15 +244,15 @@ <h2>Meta-data from the submission</h2>
244244
<th>Abstract</th>
245245
<td>
246246
{{ submission.abstract|linebreaksbr }}
247-
{% if errors.abstract %}<p class="text-danger bg-danger"><b>{{ errors.abstract }}</b></p>{% endif %}
247+
{% if errors.abstract %}<p class="text-danger"><b>{{ errors.abstract }}</b></p>{% endif %}
248248
</td>
249249
</tr>
250250

251251
<tr>
252252
<th>Pages</th>
253253
<td>
254254
{{ submission.pages }}
255-
{% if errors.pages %}<p class="text-danger bg-danger"><b>{{ errors.pages }}</b></p>{% endif %}
255+
{% if errors.pages %}<p class="text-danger"><b>{{ errors.pages }}</b></p>{% endif %}
256256
</td>
257257
</tr>
258258

@@ -265,7 +265,7 @@ <h2>Meta-data from the submission</h2>
265265
<th>Formal languages used</th>
266266
<td>
267267
{% for l in submission.formal_languages.all %}{{ l.name }}{% if not forloop.last %}, {% endif %}{% empty %}None recognized{% endfor %}
268-
{% if errors.formal_languages %}<p class="text-danger bg-danger"><b>{{ errors.formal_languages }}</b></p>{% endif %}
268+
{% if errors.formal_languages %}<p class="text-danger"><b>{{ errors.formal_languages }}</b></p>{% endif %}
269269
</td>
270270
</tr>
271271
</table>

0 commit comments

Comments
 (0)