William Grant has proposed merging 
lp:~wgrant/launchpad/no-custom-xmlrpc-rooturl into lp:launchpad.

Commit message:
Stop manually overriding the xmlrpc(_private) vhost rooturls. 
PublicXMLRPCRequest.getRootURL() will return the mainsite URL to handle 
callsites that relied on the manual overrides.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/no-custom-xmlrpc-rooturl/+merge/201891

XML-RPC requests occasionally need to use canonical_url, for the likes of 
sending emails. Since canonical_url() defaults to the request's vhost, and 
xmlrpc(_private) URLs aren't useful to users, all of our configs manually 
override the autogenerated rooturls on those vhosts to the root URL of the main 
site.

This branch removes the xmlrpc vhost rooturl overrides from the individual 
in-tree configs. Until the callsites that would break are tracked down and 
fixed to use mainsite explicitly, I've centrally asked 
PublicXMLRPCRequest.getRootURL() to give the mainsite URL for xmlrpc vhosts.
-- 
https://code.launchpad.net/~wgrant/launchpad/no-custom-xmlrpc-rooturl/+merge/201891
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~wgrant/launchpad/no-custom-xmlrpc-rooturl into lp:launchpad.
=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf	2014-01-14 06:56:23 +0000
+++ configs/development/launchpad-lazr.conf	2014-01-16 07:31:49 +0000
@@ -208,7 +208,6 @@
 
 [vhost.api]
 hostname: api.launchpad.dev
-rooturl: https://api.launchpad.dev/
 
 [vhost.blueprints]
 hostname: blueprints.launchpad.dev
@@ -230,7 +229,6 @@
 
 [vhost.xmlrpc]
 hostname: xmlrpc.launchpad.dev
-rooturl: http://launchpad.dev/
 
 [vhost.xmlrpc_private]
 hostname: xmlrpc-private.launchpad.dev

=== modified file 'configs/testrunner-appserver/launchpad-lazr.conf'
--- configs/testrunner-appserver/launchpad-lazr.conf	2014-01-14 06:56:23 +0000
+++ configs/testrunner-appserver/launchpad-lazr.conf	2014-01-16 07:31:49 +0000
@@ -47,10 +47,10 @@
 rooturl: http://testopenid.dev:8085/
 
 [vhost.xmlrpc]
-rooturl: http://launchpad.dev:8085/
+rooturl: http://xmlrpc.launchpad.dev:8085/
 
 [vhost.xmlrpc_private]
-rooturl: http://launchpad.dev:8085/
+rooturl: http://xmlrpc-private.launchpad.dev:8085/
 
 [vhost.feeds]
 rooturl: http://feeds.launchpad.dev:8085/

=== modified file 'configs/testrunner/launchpad-lazr.conf'
--- configs/testrunner/launchpad-lazr.conf	2014-01-14 06:26:47 +0000
+++ configs/testrunner/launchpad-lazr.conf	2014-01-16 07:31:49 +0000
@@ -175,12 +175,6 @@
 default_recipient_name: Root
 default_sender_name: Root
 
-[vhost.xmlrpc_private]
-rooturl: http://launchpad.dev/
-
-[vhost.api]
-rooturl: http://api.launchpad.dev/
-
 [vhosts]
 use_https: False
 

=== modified file 'lib/lp/services/webapp/doc/webapp-publication.txt'
--- lib/lp/services/webapp/doc/webapp-publication.txt	2014-01-15 06:55:24 +0000
+++ lib/lp/services/webapp/doc/webapp-publication.txt	2014-01-16 07:31:49 +0000
@@ -72,11 +72,11 @@
     althosts:
     ----
     xmlrpc @ xmlrpc.launchpad.dev
-    rooturl: http://launchpad.dev/
+    rooturl: http://xmlrpc.launchpad.dev/
     althosts:
     ----
     xmlrpc_private @ xmlrpc-private.launchpad.dev
-    rooturl: http://launchpad.dev/
+    rooturl: http://xmlrpc-private.launchpad.dev/
     althosts:
     ----
 

=== modified file 'lib/lp/services/webapp/servers.py'
--- lib/lp/services/webapp/servers.py	2013-04-10 08:05:17 +0000
+++ lib/lp/services/webapp/servers.py	2014-01-16 07:31:49 +0000
@@ -1389,6 +1389,16 @@
                           ErrorReportRequest):
     """Request type for doing public XML-RPC in Launchpad."""
 
+    def getRootURL(self, rootsite):
+        """See IBasicLaunchpadRequest."""
+        # XML-RPC requests occasionally need to use canonical_url, for
+        # the likes of sending emails. Until these are tracked down and
+        # fixed to use mainsite explicitly, replace the XML-RPC root
+        # URLs with mainsite's, so that URLs are meaningful.
+        if rootsite in (None, 'xmlrpc', 'xmlrpc_private'):
+            rootsite = 'mainsite'
+        return super(PublicXMLRPCRequest, self).getRootURL(rootsite)
+
     def _createResponse(self):
         return PublicXMLRPCResponse()
 

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to