From b058ba28ec2d7f45da8cb77ff043966516be2ef9 Mon Sep 17 00:00:00 2001
From: Lars Eggert <lars@eggert.org>
Date: Thu, 28 Oct 2021 16:24:29 +0000
Subject: [PATCH] Remove the ability to submit Postscript I-Ds.

Commit ready for merge. Fixes #3448.
 - Legacy-Id: 19486
---
 ietf/submit/forms.py                         |  7 +------
 ietf/submit/parsers/ps_parser.py             | 12 ------------
 ietf/submit/test_submission.ps               |  2 --
 ietf/submit/tests.py                         | 10 +---------
 ietf/templates/submit/tool_instructions.html |  6 +-----
 ietf/templates/submit/upload_submission.html |  8 --------
 6 files changed, 3 insertions(+), 42 deletions(-)
 delete mode 100644 ietf/submit/parsers/ps_parser.py
 delete mode 100644 ietf/submit/test_submission.ps

diff --git a/ietf/submit/forms.py b/ietf/submit/forms.py
index 12eadeb34..0ac825c47 100644
--- a/ietf/submit/forms.py
+++ b/ietf/submit/forms.py
@@ -36,7 +36,6 @@ from ietf.submit.models import Submission, Preapproval
 from ietf.submit.utils import validate_submission_name, validate_submission_rev, validate_submission_document_date
 from ietf.submit.parsers.pdf_parser import PDFParser
 from ietf.submit.parsers.plain_parser import PlainParser
-from ietf.submit.parsers.ps_parser import PSParser
 from ietf.submit.parsers.xml_parser import XMLParser
 from ietf.utils import log
 from ietf.utils.draft import Draft
@@ -450,7 +449,6 @@ class SubmissionManualUploadForm(SubmissionBaseUploadForm):
     # html for version 3 xml submissions.
     # html = forms.FileField(label='.html format', required=False)
     pdf = forms.FileField(label='.pdf format', required=False)
-    ps  = forms.FileField(label='.ps format', required=False)
 
     def __init__(self, request, *args, **kwargs):
         super(SubmissionManualUploadForm, self).__init__(request, *args, **kwargs)
@@ -463,9 +461,6 @@ class SubmissionManualUploadForm(SubmissionBaseUploadForm):
     def clean_pdf(self):
         return self.clean_file("pdf", PDFParser)
 
-    def clean_ps(self):
-        return self.clean_file("ps",  PSParser)
-
 class SubmissionAutoUploadForm(SubmissionBaseUploadForm):
     user = forms.EmailField(required=True)
 
@@ -671,4 +666,4 @@ class MessageModelForm(forms.ModelForm):
         super(MessageModelForm, self).__init__(*args, **kwargs)
         self.fields['frm'].label='From'
         self.fields['frm'].widget.attrs['readonly'] = 'True'
-        self.fields['reply_to'].widget.attrs['readonly'] = 'True'
+        self.fields['reply_to'].widget.attrs['readonly'] = 'True'
\ No newline at end of file
diff --git a/ietf/submit/parsers/ps_parser.py b/ietf/submit/parsers/ps_parser.py
deleted file mode 100644
index efb4b219e..000000000
--- a/ietf/submit/parsers/ps_parser.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from ietf.submit.parsers.base import FileParser
-
-
-class PSParser(FileParser):
-    ext = 'ps'
-    mimetypes = ['application/postscript', ]
-
-    # If some error is found after this method invocation
-    # no other file parsing is recommended
-    def critical_parse(self):
-        super(PSParser, self).critical_parse()
-        return self.parsed_info
diff --git a/ietf/submit/test_submission.ps b/ietf/submit/test_submission.ps
deleted file mode 100644
index 18c3e4192..000000000
--- a/ietf/submit/test_submission.ps
+++ /dev/null
@@ -1,2 +0,0 @@
-%%!PS-Adobe-2.0
-This is PostScript
diff --git a/ietf/submit/tests.py b/ietf/submit/tests.py
index 2df731b14..3d8878bc6 100644
--- a/ietf/submit/tests.py
+++ b/ietf/submit/tests.py
@@ -1492,7 +1492,7 @@ class SubmitTests(TestCase):
         rev = "00"
         group = "mars"
 
-        self.do_submission(name, rev, group, ["txt", "xml", "ps", "pdf"])
+        self.do_submission(name, rev, group, ["txt", "xml", "pdf"])
 
         self.assertEqual(Submission.objects.filter(name=name).count(), 1)
 
@@ -1503,8 +1503,6 @@ class SubmitTests(TestCase):
         self.assertTrue('<?xml version="1.0" encoding="UTF-8"?>' in io.open(os.path.join(self.staging_dir, "%s-%s.xml" % (name, rev))).read())
         self.assertTrue(os.path.exists(os.path.join(self.staging_dir, "%s-%s.pdf" % (name, rev))))
         self.assertTrue('This is PDF' in io.open(os.path.join(self.staging_dir, "%s-%s.pdf" % (name, rev))).read())
-        self.assertTrue(os.path.exists(os.path.join(self.staging_dir, "%s-%s.ps" % (name, rev))))
-        self.assertTrue('This is PostScript' in io.open(os.path.join(self.staging_dir, "%s-%s.ps" % (name, rev))).read())
 
     def test_expire_submissions(self):
         s = Submission.objects.create(name="draft-ietf-mars-foo",
@@ -1664,12 +1662,6 @@ class SubmitTests(TestCase):
         self.assertIn('Expected the PDF file to have extension ".pdf"', m)
         self.assertIn('Expected an PDF file of type "application/pdf"', m)
 
-    def test_submit_bad_file_ps(self):
-        r, q, m = self.submit_bad_file("some name", ["ps"])
-        self.assertIn('Invalid characters were found in the name', m)
-        self.assertIn('Expected the PS file to have extension ".ps"', m)
-        self.assertIn('Expected an PS file of type "application/postscript"', m)
-
     def test_submit_file_in_archive(self):
         name = "draft-authorname-testing-file-exists"
         rev = '00'
diff --git a/ietf/templates/submit/tool_instructions.html b/ietf/templates/submit/tool_instructions.html
index 506fb2ad9..2749f56ab 100644
--- a/ietf/templates/submit/tool_instructions.html
+++ b/ietf/templates/submit/tool_instructions.html
@@ -38,7 +38,7 @@
 
   <h3>Upload screen</h3>
   <p>
-    The Upload screen is the first screen that a user will see when he or she starts the I-D submission process. A user can submit four different formats of an I-D, plain text, XML, PDF, and postscript, at the same time. Failure to submit at least one of a plain-text or xml version will cause an error, and an error screen will be displayed. A single v3 .xml source is preferred. A single v2 .xml source will be accepted. If neither of those are available, a plain-text document may be provided.
+    The Upload screen is the first screen that a user will see when he or she starts the I-D submission process. A user can submit three different formats of an I-D, XML, plain-text, and PDF, at the same time. Failure to submit at least one of a plain-text or xml version will cause an error, and an error screen will be displayed. A single v3 .xml source is preferred. A single v2 .xml source will be accepted. If neither of those are available, a plain-text document may be provided.
   </p>
 
   <p>
@@ -70,10 +70,6 @@
       <th>.pdf format</th>
       <td>Button to select a PDF file of an I-D from a user's local file system. </td>
     </tr>
-    <tr>
-      <th>.ps format</th>
-      <td>Button to select a postscript file of an I-D from a user's local file system. </td>
-    </tr>
     <tr>
       <th>Upload</th>
       <td>Button to upload the document(s). The tool will begin parsing the plain-text document (or creating it from the xml if only xml is provided) and validate the document. The parsed meta-data will be displayed for user confirmation along with the validation results.</td>
diff --git a/ietf/templates/submit/upload_submission.html b/ietf/templates/submit/upload_submission.html
index ccd8d4ac8..b5ae426f5 100644
--- a/ietf/templates/submit/upload_submission.html
+++ b/ietf/templates/submit/upload_submission.html
@@ -80,14 +80,6 @@
                             on the submitted XML.
                         </p>
                     </div>
-
-                    <div class="form-group">
-                        {% bootstrap_field form.ps label='<i class="fa fw-fw fa-file-image-o" aria-hidden="true"></i> Postscript rendering of the I-D'%}
-                        <p class="help-block">
-                            Optional to submit, will be auto-generated based
-                            on the submitted XML.
-                        </p>
-                    </div>
                 </div>
 
                 {% bootstrap_form_errors form %}