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

Proposed by Colin Watson
Status: Merged
Merged at revision: 18568
Proposed branch: lp:~cjwatson/launchpad/ppa-vocabulary-strip-prefix
Merge into: lp:launchpad
Diff against target: 49 lines (+17/-2)
2 files modified
lib/lp/soyuz/doc/vocabularies.txt (+14/-1)
lib/lp/soyuz/vocabularies.py (+3/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/ppa-vocabulary-strip-prefix
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+340257@code.launchpad.net

Commit message

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

Description of the change

This is in line with the reference syntax.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/doc/vocabularies.txt'
2--- lib/lp/soyuz/doc/vocabularies.txt 2016-06-10 09:26:31 +0000
3+++ lib/lp/soyuz/doc/vocabularies.txt 2018-03-01 23:29:26 +0000
4@@ -230,12 +230,25 @@
5 ~cprov/ubuntu/testing: testing packages.
6
7 The vocabulary search also supports specific named PPA lookups
8-follwing the same combined syntax used to build unique tokens.
9+following the same combined syntax used to build unique tokens, including
10+some alternate and older forms.
11
12 >>> named_search = vocabulary.search(u'~cprov/ubuntu/testing')
13 >>> print_search_results(named_search)
14 ~cprov/ubuntu/testing: testing packages.
15
16+ >>> named_search = vocabulary.search(u'~cprov/testing')
17+ >>> print_search_results(named_search)
18+ ~cprov/ubuntu/testing: testing packages.
19+
20+ >>> named_search = vocabulary.search(u'ppa:cprov/ubuntu/testing')
21+ >>> print_search_results(named_search)
22+ ~cprov/ubuntu/testing: testing packages.
23+
24+ >>> named_search = vocabulary.search(u'ppa:cprov/testing')
25+ >>> print_search_results(named_search)
26+ ~cprov/ubuntu/testing: testing packages.
27+
28 As mentioned the PPA vocabulary term title only contains the first
29 line of the PPA description.
30
31
32=== modified file 'lib/lp/soyuz/vocabularies.py'
33--- lib/lp/soyuz/vocabularies.py 2015-07-08 16:05:11 +0000
34+++ lib/lp/soyuz/vocabularies.py 2018-03-01 23:29:26 +0000
35@@ -1,4 +1,4 @@
36-# Copyright 2009-2014 Canonical Ltd. This software is licensed under the GNU
37+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the GNU
38 # Affero General Public License version 3 (see the file LICENSE).
39
40 """Soyuz vocabularies."""
41@@ -127,6 +127,8 @@
42
43 if query.startswith('~'):
44 query = query.strip('~')
45+ if query.startswith('ppa:'):
46+ query = query[4:]
47 try:
48 query_split = query.split('/')
49 if len(query_split) == 3: