← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lifeless/launchpad/edge into lp:launchpad/devel

 

Robert Collins has proposed merging lp:~lifeless/launchpad/edge into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Get rid of stale 'beta redirection' code.
-- 
https://code.launchpad.net/~lifeless/launchpad/edge/+merge/39594
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/edge into lp:launchpad/devel.
=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf	2010-10-25 13:16:10 +0000
+++ lib/canonical/config/schema-lazr.conf	2010-10-29 03:01:42 +0000
@@ -1056,11 +1056,6 @@
 # datatype: string
 non_restricted_hostname: launchpad.net
 
-# If set, the host name to redirect beta testers to.
-# e.g. beta.launchpad.net
-# datatype: string
-beta_testers_redirection_host: none
-
 # Domain where incoming email related to specifications are sent to.
 # datatype: string
 specs_domain: specs.launchpad.net
@@ -2008,8 +2003,6 @@
 openid_delegate_profile: False
 
 [vhost.api]
-# This key should be removed once the production configs have been updated.
-beta_test_team: disabled
 enable_server_side_representation_cache: False
 # By default, cache representations for 4 hours.
 representation_cache_expiration_time: 14400

=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py	2010-10-27 08:51:05 +0000
+++ lib/canonical/launchpad/browser/launchpad.py	2010-10-29 03:01:42 +0000
@@ -688,29 +688,12 @@
         if WebServiceLayer.providedBy(self.request):
             return None
 
-        mainsite_host = config.vhost.mainsite.hostname
-
         # If the hostname for our URL isn't under the main site
         # (e.g. shipit.ubuntu.com), don't redirect.
         uri = URI(self.request.getURL())
-        if not uri.host.endswith(mainsite_host):
+        if not uri.host.endswith(config.vhost.mainsite.hostname):
             return None
 
-        beta_host = config.launchpad.beta_testers_redirection_host
-        user = getUtility(ILaunchBag).user
-        # Test to see if the user is None before attempting to get the
-        # launchpad_beta_testers celebrity.  In the odd test where the
-        # database is empty the series of tests will work.
-        if user is None:
-            user_is_beta_tester = False
-        else:
-            beta_testers = (
-                getUtility(ILaunchpadCelebrities).launchpad_beta_testers)
-            if user.inTeam(beta_testers):
-                user_is_beta_tester = True
-            else:
-                user_is_beta_tester = False
-
         # If the request is for a bug then redirect straight to that bug.
         bug_match = re.match("/bugs/(\d+)$", self.request['PATH_INFO'])
         if bug_match:
@@ -723,29 +706,12 @@
             if not check_permission("launchpad.View", bug):
                 raise Unauthorized("Bug %s is private" % bug_number)
             uri = URI(canonical_url(bug.default_bugtask))
-            if beta_host is not None and user_is_beta_tester:
-                # Alter the host name to point at the beta target.
-                new_host = uri.host[:-len(mainsite_host)] + beta_host
-                uri = uri.replace(host=new_host)
-        else:
-            # If no redirection host is set or the user is not a beta tester,
-            # don't redirect.
-            if beta_host is None or not user_is_beta_tester:
-                return None
-            # Alter the host name to point at the beta target.
-            new_host = uri.host[:-len(mainsite_host)] + beta_host
-            uri = uri.replace(host=new_host)
-            # Complete the URL from the environment.
-            uri = uri.replace(path=self.request['PATH_INFO'])
-            query_string = self.request.get('QUERY_STRING')
-            if query_string:
-                uri = uri.replace(query=query_string)
-
-        # Empty the traversal stack, since we're redirecting.
-        self.request.setTraversalStack([])
-
-        # And perform a temporary redirect.
-        return RedirectionView(str(uri), self.request, status=303)
+            # Empty the traversal stack, since we're redirecting.
+            self.request.setTraversalStack([])
+            # And perform a temporary redirect.
+            return RedirectionView(str(uri), self.request, status=303)
+        # Explicit catchall - do not redirect.
+        return None
 
     def publishTraverse(self, request, name):
         beta_redirection_view = self._getBetaRedirectionView()

=== modified file 'lib/canonical/launchpad/pagetests/webservice/xx-service.txt'
--- lib/canonical/launchpad/pagetests/webservice/xx-service.txt	2010-10-18 22:24:59 +0000
+++ lib/canonical/launchpad/pagetests/webservice/xx-service.txt	2010-10-29 03:01:42 +0000
@@ -30,48 +30,6 @@
     HTTP/1.1 404 Not Found
     ...
 
-No beta team redirection
-========================
-
-Members of the beta team aren't redirected to the beta site on API call.
-
-(Enable beta redirection for demonstration purpose)
-
-    >>> from canonical.config import config
-    >>> beta_data = """
-    ...     [launchpad]
-    ...     beta_testers_redirection_host = beta.launchpad.dev
-    ...     """
-    >>> config.push('beta_data', beta_data)
-
-    >>> from lp.testing import ANONYMOUS, login, logout
-    >>> from zope.component import getUtility
-    >>> from canonical.launchpad.testing.pages import webservice_for_person
-    >>> from lp.registry.interfaces.person import IPersonSet
-    >>> login(ANONYMOUS)
-    >>> beta_admin = getUtility(IPersonSet).getByEmail(
-    ...     'beta-admin@xxxxxxxxxxxxx')
-    >>> beta_user = webservice_for_person(beta_admin)
-    >>> logout()
-
-A request to the web site is redirected:
-
-    >>> print http('GET /~launchpad-beta-owner HTTP/1.1\n'
-    ... 'Host: launchpad.dev\n'
-    ... 'Authorization: Basic %s\n' %
-    ...     "beta-admin@xxxxxxxxxxxxx:test".encode('base64'))
-    HTTP/1.1 303 See Other
-    ...
-    Location: http://beta.launchpad.dev/~launchpad-beta-owner
-    ...
-
-But not a request to the web service:
-
-    >>> print beta_user.get("/~launchpad-beta-owner")
-    HTTP/1.1 200 Ok
-    ...
-
-    >>> ignored = config.pop('beta_data')
 
 Resources not exposed on the web service
 ========================================