← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/openpgp-show-fingerprint into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/openpgp-show-fingerprint into lp:launchpad.

Commit message:
Launchpad uses the full fingerprints during initial search, but from there 0xlong is used.  Show fingerprints which is the default for SKS.

Requested reviews:
  William Grant (wgrant)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/openpgp-show-fingerprint/+merge/262803

Launchpad uses the key fingerprint for the initial search, but from there SKS defaults to using 0xlong (16-character key ID).  This MP enables showing the key fingerprint as that's the SKS default; http://keyserver.ubuntu.com:11371/ has that enabled by default.

Current: http://keyserver.ubuntu.com:11371/pks/lookup?search=0x2C5CBE094DF8E590E57A8460B294FF6EFA5C7D29&op=index
With fingerprint: http://keyserver.ubuntu.com:11371/pks/lookup?search=0x2C5CBE094DF8E590E57A8460B294FF6EFA5C7D29&op=index&fingerprint=on

Also small OCD reordering of "op=index" as per web form.

(Resubmission by cjwatson after merging current devel and fixing tests.)
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/stories/person/xx-person-rdf.txt'
--- lib/lp/registry/stories/person/xx-person-rdf.txt	2011-12-23 23:44:59 +0000
+++ lib/lp/registry/stories/person/xx-person-rdf.txt	2015-06-24 00:36:50 +0000
@@ -33,7 +33,7 @@
             <wot:hex_id>12345678</wot:hex_id>
             <wot:length>1024</wot:length>
             <wot:fingerprint>ABCDEF0123456789ABCDDCBA0000111112345678</wot:fingerprint>
-            <wot:pubkeyAddress rdf:resource="http://keyserver.ubuntu.com:11371/pks/lookup?search=0xABCDEF0123456789ABCDDCBA0000111112345678&amp;op=index"/>
+            <wot:pubkeyAddress rdf:resource="http://keyserver.ubuntu.com:11371/pks/lookup?fingerprint=on&amp;op=index&amp;search=0xABCDEF0123456789ABCDDCBA0000111112345678"/>
           </wot:PubKey>
         </wot:hasKey>
       </foaf:Person>

=== modified file 'lib/lp/services/gpg/doc/gpghandler.txt'
--- lib/lp/services/gpg/doc/gpghandler.txt	2012-12-26 01:32:19 +0000
+++ lib/lp/services/gpg/doc/gpghandler.txt	2015-06-24 00:36:50 +0000
@@ -269,18 +269,18 @@
 
     >>> fingerprint = "A419AE861E88BC9E04B9C26FBA2B9389DFD20543"
     >>> gpghandler.getURLForKeyInServer(fingerprint)
-    'http://localhost:11371/pks/lookup?search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543&op=index'
+    'http://localhost:11371/pks/lookup?fingerprint=on&op=index&search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543'
 
 But you can also specify your own action:
 
     >>> gpghandler.getURLForKeyInServer(fingerprint, action="get")
-    'http://localhost:11371/pks/lookup?search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543&op=get'
+    'http://localhost:11371/pks/lookup?fingerprint=on&op=get&search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543'
 
 The method accepts a flag to retrieve a link to ubuntu's public
 keyserver web interface.
 
     >>> gpghandler.getURLForKeyInServer(fingerprint, public=True)
-    'http://keyserver.ubuntu.com:11371/pks/lookup?search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543&op=index'
+    'http://keyserver.ubuntu.com:11371/pks/lookup?fingerprint=on&op=index&search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543'
 
 
 == Keyserver uploads ==

=== modified file 'lib/lp/services/gpg/handler.py'
--- lib/lp/services/gpg/handler.py	2014-03-11 03:30:54 +0000
+++ lib/lp/services/gpg/handler.py	2015-06-24 00:36:50 +0000
@@ -462,15 +462,17 @@
     def getURLForKeyInServer(self, fingerprint, action='index', public=False):
         """See IGPGHandler"""
         params = {
+            'op': action,
             'search': '0x%s' % fingerprint,
-            'op': action,
+            'fingerprint': 'on',
             }
         if public:
             host = config.gpghandler.public_host
         else:
             host = config.gpghandler.host
-        return 'http://%s:%s/pks/lookup?%s' % (host, config.gpghandler.port,
-                                               urllib.urlencode(params))
+        return 'http://%s:%s/pks/lookup?%s' % (
+            host, config.gpghandler.port,
+            urllib.urlencode(sorted(params.items())))
 
     def _getPubKey(self, fingerprint):
         """See IGPGHandler for further information."""

=== modified file 'lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt'
--- lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt	2015-02-19 01:35:33 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt	2015-06-24 00:36:50 +0000
@@ -567,7 +567,7 @@
 
     >>> print anon_browser.getLink(
     ...     '1024D/12345678').url
-    http://keyserver.ubuntu.com:11371/pks/lookup?search=0xABCDEF0123456789ABCDDCBA0000111112345678&op=index
+    http://keyserver.ubuntu.com:11371/pks/lookup?fingerprint=on&op=index&search=0xABCDEF0123456789ABCDDCBA0000111112345678
 
 Using software from a PPA can be hard for novices. We offer two
 links to the same help pop-up that describes how to add a PPA and

=== modified file 'lib/lp/testing/keyserver/tests/test_web.py'
--- lib/lp/testing/keyserver/tests/test_web.py	2013-03-27 02:12:19 +0000
+++ lib/lp/testing/keyserver/tests/test_web.py	2015-06-24 00:36:50 +0000
@@ -107,7 +107,7 @@
     def test_index_lookup(self):
         # A key index lookup form via GET.
         return self.assertContentMatches(
-            '/pks/lookup?op=index&search=0xDFD20543',
+            '/pks/lookup?fingerprint=on&op=index&search=0xDFD20543',
             '''\
 <html>
 ...
@@ -120,7 +120,7 @@
     def test_content_lookup(self):
         # A key content lookup form via GET.
         return self.assertContentMatches(
-            '/pks/lookup?op=get&'
+            '/pks/lookup?fingerprint=on&op=get&'
             'search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543',
             '''\
 <html>
@@ -138,7 +138,7 @@
         # We can also request a key ID instead of a fingerprint, and it will
         # glob for the fingerprint.
         return self.assertContentMatches(
-            '/pks/lookup?op=get&search=0xDFD20543',
+            '/pks/lookup?fingerprint=on&op=get&search=0xDFD20543',
             '''\
 <html>
 ...
@@ -154,7 +154,7 @@
     def test_nonexistent_key(self):
         # If we request a nonexistent key, we get a nice error.
         return self.assertRaises404ErrorForKeyNotFound(
-            '/pks/lookup?op=get&search=0xDFD20544')
+            '/pks/lookup?fingerprint=on&op=get&search=0xDFD20544')
 
     def test_add_key(self):
         # A key submit form via POST (see doc/gpghandler.txt for more


Follow ups