1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
====================================
ProjectGroups and the answer tracker
====================================
Although question cannot be filed directly against project groups,
IProjectGroup in Launchpad also provides the IQuestionCollection and
ISearchableByQuestionOwner interfaces.
>>> from canonical.launchpad.webapp.testing import verifyObject
>>> from lp.registry.interfaces.projectgroup import IProjectGroupSet
>>> from lp.answers.interfaces.questioncollection import (
... ISearchableByQuestionOwner, IQuestionCollection)
>>> mozilla_project = getUtility(IProjectGroupSet).getByName('mozilla')
>>> verifyObject(IQuestionCollection, mozilla_project)
True
>>> verifyObject(ISearchableByQuestionOwner, mozilla_project)
True
Questions filed against project in a project group
==================================================
You can search for all questions filed against projects in a project using the
project group's searchQuestions() method.
>>> from lp.registry.interfaces.person import IPersonSet
>>> from lp.registry.interfaces.product import IProductSet
>>> login('test@canonical.com')
>>> thunderbird = getUtility(IProductSet).getByName('thunderbird')
>>> sample_person = getUtility(IPersonSet).getByName('name12')
>>> question = thunderbird.newQuestion(
... sample_person,
... "SVG attachments aren't displayed ",
... "It would be a nice feature if SVG attachments could be displayed"
... " inlined.")
>>> for question in mozilla_project.searchQuestions(search_text='svg'):
... print question.title, question.target.displayname
SVG attachments aren't displayed Mozilla Thunderbird
Problem showing the SVG demo on W3C site Mozilla Firefox
In the case where a project group has no projects, there are no results.
>>> aaa_project = getUtility(IProjectGroupSet).getByName('aaa')
>>> list(aaa_project.searchQuestions())
[]
Questions can be searched by all the standard searchQuestions() parameters.
See questiontarget.txt for the full details.
>>> from lp.answers.enums import (
... QuestionSort, QuestionStatus)
>>> for question in mozilla_project.searchQuestions(
... owner=sample_person, status=QuestionStatus.OPEN,
... sort=QuestionSort.OLDEST_FIRST):
... print question.title, question.target.displayname
Problem showing the SVG demo on W3C site Mozilla Firefox
SVG attachments aren't displayed Mozilla Thunderbird
Languages
=========
getQuestionLanguages() returns the set of languages that is used by all the
questions in the project group's projects.
# The Firefox project group has one question created in Brazilian
# Portuguese.
>>> print ', '.join(
... sorted(language.code
... for language in mozilla_project.getQuestionLanguages()))
en, pt_BR
In the case where a project group has no projects, there are no results.
>>> list(aaa_project.getQuestionLanguages())
[]
|