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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
= The Launchpad Answer Tracker =
Launchpad has an 'Answer Tracker' built in to it. So you can have your
community answers user questions about any upstream application, or any
distribution.
== Products ==
Creating a new question is possible directly from the main page of a
product. Users simply click the 'Ask a question' buttion.
>>> user_browser.open('http://launchpad.dev/firefox')
>>> user_browser.getLink('Ask a question').click()
>>> print user_browser.title
Ask a question about...
There is also an 'Ask a question' link on the Bugs home page of the
product:
>>> user_browser.open('http://bugs.launchpad.dev/firefox')
>>> user_browser.getLink('Ask a question').click()
>>> print user_browser.title
Ask a question about...
The list of all the currently active questions for the product is
available from the 'Answers' facet.
>>> browser.open('http://launchpad.dev/firefox')
>>> browser.getLink('Answers').click()
>>> soup = find_main_content(browser.contents)
>>> print soup.first('h1').renderContents()
Questions for Mozilla Firefox
>>> browser.getLink('Firefox loses focus and gets stuck').url
'.../firefox/+question/4'
There is also an 'Ask a question' link to ask a new question.
>>> browser.getLink('Ask a question').url
'http://answers.launchpad.dev/firefox/+addquestion'
There are links to some common listing of questions:
>>> browser.getLink('Open').url
'.../firefox/+questions?...'
>>> browser.getLink('Answered').url
'.../firefox/+questions?...'
>>> browser.getLink('My questions').url
'.../firefox/+myquestions'
Information on a particular question can be seen by browsing to the
question page.
>>> browser.getLink('Problem showing the SVG demo on W3C site').click()
>>> print browser.title
Question #2 : ...
>>> print find_main_content(browser.contents).first('h1').renderContents()
Problem showing the SVG demo on W3C site
== Distributions ==
Distributions have an 'Ask a question' link on the front page:
>>> user_browser.open('http://launchpad.dev/ubuntu')
>>> user_browser.getLink('Ask a question').click()
>>> print user_browser.title
Ask a question about...
As well as on the Bugs facet home page:
>>> user_browser.open('http://bugs.launchpad.dev/ubuntu')
>>> user_browser.getLink('Ask a question').click()
>>> print user_browser.title
Ask a question about...
The distribution home page also has a link to the 'Answers' facet:
>>> browser.open('http://launchpad.dev/ubuntu')
>>> browser.getLink('Answers').url
'http://answers.launchpad.dev/ubuntu'
>>> browser.getLink('Answers').click()
>>> print browser.title
Questions : Ubuntu
>>> browser.getLink('Ask a question')
<Link...>
On that facet, we will find the same common listings:
>>> browser.getLink('Open').url
'.../ubuntu/+questions?...'
>>> browser.getLink('Answered').url
'.../ubuntu/+questions?...'
>>> browser.getLink('My questions').url
'.../ubuntu/+myquestions'
== Source packages ==
On a source package, the 'Ask a question' link is accessible through
the Answers facet.
>>> browser.open('http://launchpad.dev/ubuntu/hoary/+source/evolution')
>>> browser.getLink('Answers').url
'http://answers.launchpad.dev/ubuntu/hoary/+source/evolution'
>>> browser.getLink('Answers').click()
>>> print browser.title
Questions : ...evolution... source package : Hoary (5.04) : Ubuntu
>>> browser.getLink('Ask a question').url
'.../ubuntu/hoary/+source/evolution/+addquestion'
As are the common listings:
>>> browser.getLink('Open').url
'.../ubuntu/hoary/+source/evolution/+questions?...'
>>> browser.getLink('Answered').url
'.../ubuntu/hoary/+source/evolution/+questions?...'
>>> browser.getLink('My questions').url
'.../ubuntu/hoary/+source/evolution/+myquestions'
The 'Answers' facet is also available on the distribution source package
page:
>>> browser.open('http://launchpad.dev/ubuntu/+source/mozilla-firefox')
>>> browser.getLink('Answers').url
'http://answers.launchpad.dev/ubuntu/+source/mozilla-firefox'
>>> browser.getLink('Answers').click()
>>> browser.title
'Questions : \xe2\x80\x9cmozilla-firefox\xe2\x80\x9d package : Ubuntu'
>>> browser.getLink('Ask a question').url
'.../ubuntu/+source/mozilla-firefox/+addquestion'
>>> browser.getLink('Open').url
'.../ubuntu/+source/mozilla-firefox/+questions?...'
>>> browser.getLink('Answered').url
'.../ubuntu/+source/mozilla-firefox/+questions?...'
>>> browser.getLink('My questions').url
'.../ubuntu/+source/mozilla-firefox/+myquestions'
== ProjectGroups ==
ProjectGroups also have the 'Latest questions' portlet and the
'Ask a question' button on their overview page.
>>> user_browser.open('http://launchpad.dev/mozilla')
>>> questions = find_tag_by_id(
... user_browser.contents, 'portlet-latest-questions')
>>> print extract_text(questions).encode('ASCII', 'backslashreplace')
All questions
Latest questions
Problemas de Impress\xe3o no Firefox ...
Newly installed plug-in doesn't seem to be used ...
Firefox loses focus and gets stuck ...
Problem showing the SVG demo on W3C site ...
Firefox cannot render Bank Site ...
>>> user_browser.getLink('Ask a question').click()
>>> print user_browser.title
Ask a question about...
== Persons ==
The 'Answers' facet link will display a page listing all the questions
involving a person.
>>> browser.open('http://launchpad.dev/~name16')
>>> browser.getLink('Answers').url
'http://answers.launchpad.dev/~name16'
>>> browser.getLink('Answers').click()
>>> print browser.title
Questions : Foo Bar
>>> print find_main_content(browser.contents).first('h1').renderContents()
Questions for Foo Bar
>>> browser.getLink('Slow system').url
'.../ubuntu/+question/7'
# One of them is not on this batch, so we'll have to first go to the next
# batch.
>>> browser.getLink('Next').click()
>>> browser.getLink('Firefox loses focus').url
'.../firefox/+question/4'
== Accessing a question directly ==
You can access any question by its ID using the URL
http://answers.launchpad.dev/questions/<id>. This URL will redirect
to the proper context where the question can be found:
>>> browser.open('http://answers.launchpad.dev/questions/1')
>>> print browser.url
http://answers.launchpad.dev/firefox/+question/1
>>> print find_main_content(browser.contents).find('h1').renderContents()
Firefox cannot render Bank Site
Asking for a non-existent question or an invalid ID will still
raise a 404 though:
>>> browser.open('http://answers.launchpad.dev/questions/255')
Traceback (most recent call last):
...
NotFound: ...
>>> browser.open('http://answers.launchpad.dev/questions/bad_id')
Traceback (most recent call last):
...
NotFound: ...
Also If you access a question through the wrong context, you'll be
redirected to the question in the proper context. (For example, this
is useful after a question was retargeted.)
>>> browser.open('http://answers.launchpad.dev/ubuntu/+question/1')
>>> print browser.url
http://answers.launchpad.dev/firefox/+question/1
It also works with pages below that URL:
>>> browser.open(
... 'http://answers.launchpad.dev/ubuntu/+question/1/+history')
>>> print browser.url
http://answers.launchpad.dev/firefox/+question/1/+history
But again, an invalid ID still raises a 404:
>>> browser.open('http://answers.launchpad.dev/ubuntu/+question/255')
Traceback (most recent call last):
...
NotFound: ...
>>> browser.open(
... 'http://answers.launchpad.dev/ubuntu/+question/bad_id')
Traceback (most recent call last):
...
NotFound: ...
|