← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/ppa-vocabulary-strip-prefix into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/ppa-vocabulary-strip-prefix into lp:launchpad.

Commit message:
Handle queries starting with "ppa:" when searching the PPA vocabulary.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/ppa-vocabulary-strip-prefix/+merge/340257

This is in line with the reference syntax.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/ppa-vocabulary-strip-prefix into lp:launchpad.
=== modified file 'lib/lp/soyuz/doc/vocabularies.txt'
--- lib/lp/soyuz/doc/vocabularies.txt	2016-06-10 09:26:31 +0000
+++ lib/lp/soyuz/doc/vocabularies.txt	2018-03-01 23:29:26 +0000
@@ -230,12 +230,25 @@
     ~cprov/ubuntu/testing: testing packages.
 
 The vocabulary search also supports specific named PPA lookups
-follwing the same combined syntax used to build unique tokens.
+following the same combined syntax used to build unique tokens, including
+some alternate and older forms.
 
     >>> named_search = vocabulary.search(u'~cprov/ubuntu/testing')
     >>> print_search_results(named_search)
     ~cprov/ubuntu/testing: testing packages.
 
+    >>> named_search = vocabulary.search(u'~cprov/testing')
+    >>> print_search_results(named_search)
+    ~cprov/ubuntu/testing: testing packages.
+
+    >>> named_search = vocabulary.search(u'ppa:cprov/ubuntu/testing')
+    >>> print_search_results(named_search)
+    ~cprov/ubuntu/testing: testing packages.
+
+    >>> named_search = vocabulary.search(u'ppa:cprov/testing')
+    >>> print_search_results(named_search)
+    ~cprov/ubuntu/testing: testing packages.
+
 As mentioned the PPA vocabulary term title only contains the first
 line of the PPA description.
 

=== modified file 'lib/lp/soyuz/vocabularies.py'
--- lib/lp/soyuz/vocabularies.py	2015-07-08 16:05:11 +0000
+++ lib/lp/soyuz/vocabularies.py	2018-03-01 23:29:26 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the GNU
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the GNU
 # Affero General Public License version 3 (see the file LICENSE).
 
 """Soyuz vocabularies."""
@@ -127,6 +127,8 @@
 
         if query.startswith('~'):
             query = query.strip('~')
+        if query.startswith('ppa:'):
+            query = query[4:]
         try:
             query_split = query.split('/')
             if len(query_split) == 3:


Follow ups