← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-98437-workarounds into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-98437-workarounds into launchpad:master.

Commit message:
Remove workarounds for bug 98437, fixed in Zope

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/374726

We've had sufficient versions of zope.app.testing and zope.testbrowser for a while.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-98437-workarounds into launchpad:master.
diff --git a/lib/lp/app/stories/basics/notfound-error.txt b/lib/lp/app/stories/basics/notfound-error.txt
index ba3a48a..f6b0d75 100644
--- a/lib/lp/app/stories/basics/notfound-error.txt
+++ b/lib/lp/app/stories/basics/notfound-error.txt
@@ -29,22 +29,19 @@ It also contains instructions specific to broken links.
 If you go to a non-existent page directly, without sending a Referer:
 header, the 404 page does not try to link to the referring page.
 And the advice about broken links is gone, replaced with advice about
-mistyped URLs.
+things like mistyped URLs.
 
-XXX 20080114 mpt: At the time of writing, this test passed if
-'"HTTP_REFERER": self.host_and_port,' was commented out of
-sourcecode/zope/src/zope/app/testing/functional.py. The test is
-disabled until bug 98437 is fixed.
-
-    # >>> page_with_no_referer = str(http(r"""
-    # ... GET /+fhqwhgads HTTP/1.1
-    # ... """))
-    # >>> print page_with_no_referer
-    # HTTP/1.1 404 Not Found
-    # ...
-    # >>> main_content = find_main_content(page_with_no_referer)
-    # >>> for paragraph in main_content('p'):
-    # ...     print extract_text(paragraph)
-    # There’s no page with this address in Launchpad.
-    # Check that you entered the address correctly.
-    # ...
+    >>> page_with_no_referer = str(http(r"""
+    ... GET /+fhqwhgads HTTP/1.1
+    ... """))
+    >>> print page_with_no_referer
+    HTTP/1.1 404 Not Found
+    ...
+    >>> main_content = find_main_content(page_with_no_referer)
+    >>> for paragraph in main_content('p'):
+    ...     print extract_text(paragraph)
+    This page does not exist, or you may not have permission to see it.
+    If you have been to this page before, it is possible it has been removed.
+    Check that you are logged in with the correct account, or that you
+    entered the address correctly, or search for it:
+    ...
diff --git a/lib/lp/bugs/browser/bugsubscription.py b/lib/lp/bugs/browser/bugsubscription.py
index 544ae49..b8a689e 100644
--- a/lib/lp/bugs/browser/bugsubscription.py
+++ b/lib/lp/bugs/browser/bugsubscription.py
@@ -181,13 +181,10 @@ class BugSubscriptionSubscribeSelfView(LaunchpadFormView,
         referer = self._return_url
         context_url = canonical_url(self.context)
 
-        # XXX bdmurray 2010-09-30 bug=98437: work around zope's test
-        # browser setting referer to localhost.
-        # We also ignore the current request URL and the context URL as
-        # far as referrers are concerned so that we can handle privacy
-        # issues properly.
-        ignored_referrer_urls = (
-            'localhost', self.request.getURL(), context_url)
+        # Ignore the current request URL and the context URL as far as
+        # referrers are concerned so that we can handle privacy issues
+        # properly.
+        ignored_referrer_urls = (self.request.getURL(), context_url)
         if referer and referer not in ignored_referrer_urls:
             next_url = referer
         elif self._redirecting_to_bug_list:
diff --git a/lib/lp/bugs/browser/bugtask.py b/lib/lp/bugs/browser/bugtask.py
index 0b9ec84..b25e213 100644
--- a/lib/lp/bugs/browser/bugtask.py
+++ b/lib/lp/bugs/browser/bugtask.py
@@ -464,10 +464,7 @@ class BugTaskView(LaunchpadView, BugViewMixin, FeedsMixin):
     def next_url(self):
         """Provided so returning to the page they came from works."""
         referer = self.request.getHeader('referer')
-
-        # XXX bdmurray 2010-09-30 bug=98437: work around zope's test
-        # browser setting referer to localhost.
-        if referer and referer != 'localhost':
+        if referer:
             next_url = referer
         else:
             next_url = canonical_url(self.context)
@@ -477,10 +474,7 @@ class BugTaskView(LaunchpadView, BugViewMixin, FeedsMixin):
     def cancel_url(self):
         """Provided so returning to the page they came from works."""
         referer = self.request.getHeader('referer')
-
-        # XXX bdmurray 2010-09-30 bug=98437: work around zope's test
-        # browser setting referer to localhost.
-        if referer and referer != 'localhost':
+        if referer:
             cancel_url = referer
         else:
             cancel_url = canonical_url(self.context)
diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
index ece870a..716dd2e 100644
--- a/lib/lp/services/webapp/publication.py
+++ b/lib/lp/services/webapp/publication.py
@@ -153,14 +153,6 @@ def maybe_block_offsite_form_post(request):
     referrer = request.getHeader('referer')  # Match HTTP spec misspelling.
     if not referrer:
         raise NoReferrerError('No value for REFERER header')
-    # XXX: jamesh 2007-04-26 bug=98437:
-    # The Zope testing infrastructure sets a default (incorrect)
-    # referrer value of "localhost" or "localhost:9000" if no
-    # referrer is included in the request.  We let it pass through
-    # here for the benefits of the tests.  Web browsers send full
-    # URLs so this does not open us up to extra XSRF attacks.
-    if referrer in ['localhost', 'localhost:9000']:
-        return
     # Extract the hostname from the referrer URI
     try:
         hostname = URI(referrer).host
diff --git a/lib/lp/testing/browser.py b/lib/lp/testing/browser.py
index e858d95..b72d82c 100644
--- a/lib/lp/testing/browser.py
+++ b/lib/lp/testing/browser.py
@@ -103,26 +103,6 @@ class Browser(_Browser):
         super(Browser, self)._changed()
         transaction.commit()
 
-    def _clickSubmit(self, form, control, coord):
-        # XXX gary 2010-03-08 bug=98437
-        # This change is taken from
-        # https://bugs.launchpad.net/zope3/+bug/98437/comments/9 .  It
-        # should be pushed upstream, per that comment.
-        labels = control.get_labels()
-        if labels:
-            label = labels[0].text
-        else:
-            label = None
-        self.mech_browser.form = form
-        self._start_timer()
-        try:
-            self.mech_browser.submit(id=control.id, name=control.name,
-                label=label, coord=coord)
-        except Exception as e:
-            fix_exception_name(e)
-            raise
-        self._stop_timer()
-
     @property
     def vhost(self):
         uri = URI(self.url)
diff --git a/lib/lp/translations/stories/importqueue/xx-translation-import-queue-entry.txt b/lib/lp/translations/stories/importqueue/xx-translation-import-queue-entry.txt
index 3d70b1d..0076838 100644
--- a/lib/lp/translations/stories/importqueue/xx-translation-import-queue-entry.txt
+++ b/lib/lp/translations/stories/importqueue/xx-translation-import-queue-entry.txt
@@ -7,9 +7,6 @@ Submission and cancellation links
 If we load an import queue entry directly from the global import queue and
 approve it, we end up back on the global translations import queue.
 
-XXX DaniloSegan 2009-09-01: due to Zope bug #98437 we can't test that
-this works properly when no "referer" header is sent.
-
     >>> admin_browser.open('http://translations.launchpad.test/+imports')
     >>> admin_browser.getLink(url='imports/1').click()
     >>> print(admin_browser.getLink('Cancel').url)