Repository: ietf-tools/datatracker

Issue:
Update the shepherd writeup templates in the datatracker
See https://chairs.ietf.org/documents/qa-style-writeup-template




Discussion:

Resolving patch:
diff --git a/ietf/submit/forms.py b/ietf/submit/forms.py
--- a/ietf/submit/forms.py
+++ b/ietf/submit/forms.py
@@ -33,7 +33,7 @@
 from ietf.message.models import Message
 from ietf.name.models import FormalLanguageName, GroupTypeName
 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.utils import validate_submission_name, validate_submission_rev, validate_submission_document_date, remote_ip
 from ietf.submit.parsers.pdf_parser import PDFParser
 from ietf.submit.parsers.plain_parser import PlainParser
 from ietf.submit.parsers.xml_parser import XMLParser
@@ -47,7 +47,7 @@ class SubmissionBaseUploadForm(forms.Form):
     def __init__(self, request, *args, **kwargs):
         super(SubmissionBaseUploadForm, self).__init__(*args, **kwargs)
 
-        self.remote_ip = request.META.get('REMOTE_ADDR', None)
+        self.remote_ip = remote_ip(request)
 
         self.request = request
         self.in_first_cut_off = False
diff --git a/ietf/submit/utils.py b/ietf/submit/utils.py
--- a/ietf/submit/utils.py
+++ b/ietf/submit/utils.py
@@ -1030,3 +1030,12 @@ def update_submission_external_resources(submission, new_resources):
     for new_res in new_resources:
         new_res.submission = submission
         new_res.save()
+
+def remote_ip(request):
+    if 'CF-Connecting-IP' in request.META:
+        remote_ip = request.META.get('CF-Connecting-IP')
+    elif 'X-Forwarded-For' in request.META:
+        remote_ip = request.META.get('X-Forwarded-For').split(',')[0]
+    else:
+        remote_ip = request.META.get('REMOTE_ADDR', None)
+    return remote_ip
diff --git a/ietf/submit/views.py b/ietf/submit/views.py
--- a/ietf/submit/views.py
+++ b/ietf/submit/views.py
@@ -39,7 +39,7 @@
     post_submission, cancel_submission, rename_submission_files, remove_submission_files, get_draft_meta,
     get_submission, fill_in_submission, apply_checkers, save_files, 
     check_submission_revision_consistency, accept_submission, accept_submission_requires_group_approval,
-    accept_submission_requires_prev_auth_approval, update_submission_external_resources )
+    accept_submission_requires_prev_auth_approval, update_submission_external_resources, remote_ip )
 from ietf.stats.utils import clean_country_name
 from ietf.utils.accesstoken import generate_access_token
 from ietf.utils.log import log
@@ -729,7 +729,7 @@ def add_manualpost_email(request, submission_id=None, access_token=None):
     
                 submission, submission_email_event = (
                     add_submission_email(request=request,
-                                         remote_ip=request.META.get('REMOTE_ADDR', None),
+                                         remote_ip=remote_ip(request),
                                          name = form.draft_name,
                                          rev=form.revision,
                                          submission_pk = submission_pk,


Test patch:
diff --git a/ietf/release/tests.py b/ietf/release/tests.py
--- a/ietf/release/tests.py
+++ b/ietf/release/tests.py
@@ -11,8 +11,6 @@
 from ietf.utils.test_utils import TestCase
 
 class ReleasePagesTest(TestCase):
-
-        
     def test_about(self):
         url = reverse('ietf.release.views.release')+"about"
         r = self.client.get(url)