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
=== 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 @@
230 ~cprov/ubuntu/testing: testing packages.230 ~cprov/ubuntu/testing: testing packages.
231231
232The vocabulary search also supports specific named PPA lookups232The vocabulary search also supports specific named PPA lookups
233follwing the same combined syntax used to build unique tokens.233following the same combined syntax used to build unique tokens, including
234some alternate and older forms.
234235
235 >>> named_search = vocabulary.search(u'~cprov/ubuntu/testing')236 >>> named_search = vocabulary.search(u'~cprov/ubuntu/testing')
236 >>> print_search_results(named_search)237 >>> print_search_results(named_search)
237 ~cprov/ubuntu/testing: testing packages.238 ~cprov/ubuntu/testing: testing packages.
238239
240 >>> named_search = vocabulary.search(u'~cprov/testing')
241 >>> print_search_results(named_search)
242 ~cprov/ubuntu/testing: testing packages.
243
244 >>> named_search = vocabulary.search(u'ppa:cprov/ubuntu/testing')
245 >>> print_search_results(named_search)
246 ~cprov/ubuntu/testing: testing packages.
247
248 >>> named_search = vocabulary.search(u'ppa:cprov/testing')
249 >>> print_search_results(named_search)
250 ~cprov/ubuntu/testing: testing packages.
251
239As mentioned the PPA vocabulary term title only contains the first252As mentioned the PPA vocabulary term title only contains the first
240line of the PPA description.253line of the PPA description.
241254
242255
=== 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 @@
1# Copyright 2009-2014 Canonical Ltd. This software is licensed under the GNU1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the GNU
2# Affero General Public License version 3 (see the file LICENSE).2# Affero General Public License version 3 (see the file LICENSE).
33
4"""Soyuz vocabularies."""4"""Soyuz vocabularies."""
@@ -127,6 +127,8 @@
127127
128 if query.startswith('~'):128 if query.startswith('~'):
129 query = query.strip('~')129 query = query.strip('~')
130 if query.startswith('ppa:'):
131 query = query[4:]
130 try:132 try:
131 query_split = query.split('/')133 query_split = query.split('/')
132 if len(query_split) == 3:134 if len(query_split) == 3: