Merge lp:~bac/launchpad/bug-745660 into lp:launchpad
- bug-745660
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12717 |
Proposed branch: | lp:~bac/launchpad/bug-745660 |
Merge into: | lp:launchpad |
Diff against target: |
764 lines (+145/-518) 5 files modified
.bzrignore (+1/-0) Makefile (+17/-12) lib/canonical/launchpad/icing/icon-sprites.positioning (+0/-484) lib/lp/bugs/browser/structuralsubscription.py (+13/-3) lib/lp/bugs/browser/tests/test_expose.py (+114/-19) |
To merge this branch: | bzr merge lp:~bac/launchpad/bug-745660 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+55636@code.launchpad.net |
Commit message
[r=allenap][bug=745660] Filter the list of administered teams shown for structural subscriptions to distributions when a bug supervisor is set.
Description of the change
= Summary =
If a distribution has a bug supervisor team set then only members of
that team my have a structural subscription to that distro. This branch
filters out those teams from the ones presented in the structural
subscription widget.
== Proposed fix ==
The set of teams exposed to JavaScript is filtered under the conditions
stated above.
== Pre-implementation notes ==
Chats with Gary about the problem.
== Implementation details ==
As above.
== Tests ==
bin/test -vvm lp.bugs -t test_expose
== Demo and Q/A ==
Go to https:/
malone.
Login as stevea/test.
Go to https:/
Note that 'Ubuntu Gnome Team' is in the list of teams Steve can subscribe.
Go to http://
bug supervisor. You'll note that Ubuntu Gnome Team is not a member of
Ubuntu Team.
Go back to https:/
mail'. Now you'll see that Ubuntu Gnome Team is not one of his
selections. QED.
= Launchpad lint =
(Will fix as appropriate.)
Checking for conflicts and issues in changed files.
Linting changed files:
.bzrignore
lib/lp/
lib/lp/
Makefile
./lib/lp/
111: E231 missing whitespace after ','
./Makefile
81: Line exceeds 78 characters.
159: Line exceeds 78 characters.
289: Line exceeds 78 characters.
416: Line exceeds 78 characters.
446: Line exceeds 78 characters.
480: Line exceeds 78 characters.
Brad Crittenden (bac) wrote : | # |
Gavin Panella (allenap) wrote : | # |
Cool, +1.
[1]
+${ICING}
+ ${SHHH} bin/sprite-util create-image
+
+${ICING}
${SHHH} bin/sprite-util create-image
Although make seems to see that the command is identical and only runs
it once, it might be clearer for future maintainers to express it
instead as:
${ICING}
${SHHH} bin/sprite-util create-image
[2]
+ def _sort(self, team_info, key='title'):
+ return sorted(team_info, cmp=lambda a,b: cmp(a[key], b[key]))
The cmp argument to sorted it deprecated and is gone in Python 3. This
could be expressed instead as:
return sorted(team_info, key=lambda item: item[key])
or:
return sorted(team_info, key=itemgetter(
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2011-03-30 19:42:37 +0000 | |||
3 | +++ .bzrignore 2011-03-31 15:37:43 +0000 | |||
4 | @@ -80,3 +80,4 @@ | |||
5 | 80 | .idea | 80 | .idea |
6 | 81 | run.gdb | 81 | run.gdb |
7 | 82 | lib/canonical/launchpad/icing/icon-sprites | 82 | lib/canonical/launchpad/icing/icon-sprites |
8 | 83 | lib/canonical/launchpad/icing/icon-sprites.positioning | ||
9 | 83 | 84 | ||
10 | === modified file 'Makefile' | |||
11 | --- Makefile 2011-03-30 19:42:37 +0000 | |||
12 | +++ Makefile 2011-03-31 15:37:43 +0000 | |||
13 | @@ -78,7 +78,8 @@ | |||
14 | 78 | $(API_INDEX): $(BZR_VERSION_INFO) $(PY) | 78 | $(API_INDEX): $(BZR_VERSION_INFO) $(PY) |
15 | 79 | rm -rf $(APIDOC_DIR) $(APIDOC_DIR).tmp | 79 | rm -rf $(APIDOC_DIR) $(APIDOC_DIR).tmp |
16 | 80 | mkdir -p $(APIDOC_DIR).tmp | 80 | mkdir -p $(APIDOC_DIR).tmp |
18 | 81 | LPCONFIG=$(LPCONFIG) $(PY) ./utilities/create-lp-wadl-and-apidoc.py --force "$(WADL_TEMPLATE)" | 81 | LPCONFIG=$(LPCONFIG) $(PY) ./utilities/create-lp-wadl-and-apidoc.py \ |
19 | 82 | --force "$(WADL_TEMPLATE)" | ||
20 | 82 | mv $(APIDOC_DIR).tmp $(APIDOC_DIR) | 83 | mv $(APIDOC_DIR).tmp $(APIDOC_DIR) |
21 | 83 | 84 | ||
22 | 84 | apidoc: compile $(API_INDEX) | 85 | apidoc: compile $(API_INDEX) |
23 | @@ -156,12 +157,13 @@ | |||
24 | 156 | 157 | ||
25 | 157 | sprite_css: ${LP_BUILT_JS_ROOT}/sprite.css | 158 | sprite_css: ${LP_BUILT_JS_ROOT}/sprite.css |
26 | 158 | 159 | ||
28 | 159 | ${LP_BUILT_JS_ROOT}/sprite.css: bin/sprite-util ${ICING}/sprite.css.in ${ICING}/icon-sprites.positioning | 160 | ${LP_BUILT_JS_ROOT}/sprite.css: bin/sprite-util ${ICING}/sprite.css.in \ |
29 | 161 | ${ICING}/icon-sprites.positioning | ||
30 | 160 | ${SHHH} bin/sprite-util create-css | 162 | ${SHHH} bin/sprite-util create-css |
31 | 161 | 163 | ||
33 | 162 | sprite_image: ${ICING}/icon-sprites | 164 | sprite_image: ${ICING}/icon-sprites ${ICING}/icon-sprites.positioning |
34 | 163 | 165 | ||
36 | 164 | ${ICING}/icon-sprites: bin/sprite-util ${ICING}/icon-sprites.positioning | 166 | ${ICING}/icon-sprites.positioning ${ICING}/icon-sprites: bin/sprite-util |
37 | 165 | ${SHHH} bin/sprite-util create-image | 167 | ${SHHH} bin/sprite-util create-image |
38 | 166 | 168 | ||
39 | 167 | # We absolutely do not want to include the lazr.testing module and | 169 | # We absolutely do not want to include the lazr.testing module and |
40 | @@ -410,7 +412,9 @@ | |||
41 | 410 | /var/tmp/testkeyserver | 412 | /var/tmp/testkeyserver |
42 | 411 | # /var/tmp/launchpad_mailqueue is created read-only on ec2test | 413 | # /var/tmp/launchpad_mailqueue is created read-only on ec2test |
43 | 412 | # instances. | 414 | # instances. |
45 | 413 | if [ -w /var/tmp/launchpad_mailqueue ]; then $(RM) -rf /var/tmp/launchpad_mailqueue; fi | 415 | if [ -w /var/tmp/launchpad_mailqueue ]; then \ |
46 | 416 | $(RM) -rf /var/tmp/launchpad_mailqueue; \ | ||
47 | 417 | fi | ||
48 | 414 | 418 | ||
49 | 415 | 419 | ||
50 | 416 | realclean: clean | 420 | realclean: clean |
51 | @@ -474,10 +478,11 @@ | |||
52 | 474 | --docformat restructuredtext --verbose-about epytext-summary \ | 478 | --docformat restructuredtext --verbose-about epytext-summary \ |
53 | 475 | $(PYDOCTOR_OPTIONS) | 479 | $(PYDOCTOR_OPTIONS) |
54 | 476 | 480 | ||
62 | 477 | .PHONY: apidoc buildout_bin check doc tags TAGS zcmldocs realclean clean debug \ | 481 | .PHONY: apidoc buildout_bin check doc tags TAGS zcmldocs realclean \ |
63 | 478 | stop start run ftest_build ftest_inplace test_build test_inplace \ | 482 | clean debug stop start run ftest_build ftest_inplace \ |
64 | 479 | pagetests check schema default launchpad.pot pull_branches \ | 483 | test_build test_inplace pagetests check schema default \ |
65 | 480 | scan_branches sync_branches reload-apache hosted_branches \ | 484 | launchpad.pot pull_branches scan_branches sync_branches \ |
66 | 481 | check_mailman check_config jsbuild jsbuild_lazr clean_js \ | 485 | reload-apache hosted_branches check_mailman check_config \ |
67 | 482 | clean_buildout buildonce_eggs build_eggs sprite_css sprite_image \ | 486 | jsbuild jsbuild_lazr clean_js clean_buildout buildonce_eggs \ |
68 | 483 | css_combine compile check_schema pydoctor clean_logs \ | 487 | build_eggs sprite_css sprite_image css_combine compile \ |
69 | 488 | check_schema pydoctor clean_logs | ||
70 | 484 | 489 | ||
71 | === removed file 'lib/canonical/launchpad/icing/icon-sprites.positioning' | |||
72 | --- lib/canonical/launchpad/icing/icon-sprites.positioning 2011-03-22 05:56:34 +0000 | |||
73 | +++ lib/canonical/launchpad/icing/icon-sprites.positioning 1970-01-01 00:00:00 +0000 | |||
74 | @@ -1,484 +0,0 @@ | |||
75 | 1 | /* DO NOT EDIT THIS FILE BY HAND!!! */ | ||
76 | 2 | /* It is autogenerated by spriteutils. */ | ||
77 | 3 | { | ||
78 | 4 | "../images/arrowLeft.png": [ | ||
79 | 5 | 0, | ||
80 | 6 | -14918 | ||
81 | 7 | ], | ||
82 | 8 | "../images/cancel.png": [ | ||
83 | 9 | 0, | ||
84 | 10 | -7540 | ||
85 | 11 | ], | ||
86 | 12 | "../images/milestone.png": [ | ||
87 | 13 | 0, | ||
88 | 14 | -3440 | ||
89 | 15 | ], | ||
90 | 16 | "../images/build-needed.png": [ | ||
91 | 17 | 0, | ||
92 | 18 | -13442 | ||
93 | 19 | ], | ||
94 | 20 | "../images/team.png": [ | ||
95 | 21 | 0, | ||
96 | 22 | -2130 | ||
97 | 23 | ], | ||
98 | 24 | "../images/bug-undecided.png": [ | ||
99 | 25 | 0, | ||
100 | 26 | -8036 | ||
101 | 27 | ], | ||
102 | 28 | "../images/blueprint-low.png": [ | ||
103 | 29 | 0, | ||
104 | 30 | -5900 | ||
105 | 31 | ], | ||
106 | 32 | "../images/meeting.png": [ | ||
107 | 33 | 0, | ||
108 | 34 | -10490 | ||
109 | 35 | ], | ||
110 | 36 | "../images/no.png": [ | ||
111 | 37 | 0, | ||
112 | 38 | -1312 | ||
113 | 39 | ], | ||
114 | 40 | "../images/distribution-badge.png": [ | ||
115 | 41 | 0, | ||
116 | 42 | -9184 | ||
117 | 43 | ], | ||
118 | 44 | "../images/arrowTop.png": [ | ||
119 | 45 | 0, | ||
120 | 46 | -14590 | ||
121 | 47 | ], | ||
122 | 48 | "../images/zoom-in.png": [ | ||
123 | 49 | 0, | ||
124 | 50 | -11802 | ||
125 | 51 | ], | ||
126 | 52 | "../images/team-badge.png": [ | ||
127 | 53 | 0, | ||
128 | 54 | -2294 | ||
129 | 55 | ], | ||
130 | 56 | "../images/blue-bar.png": [ | ||
131 | 57 | 0, | ||
132 | 58 | -15082 | ||
133 | 59 | ], | ||
134 | 60 | "../images/arrowStart.png": [ | ||
135 | 61 | 0, | ||
136 | 62 | -14262 | ||
137 | 63 | ], | ||
138 | 64 | "../images/ppa-icon-inactive.png": [ | ||
139 | 65 | 0, | ||
140 | 66 | -12458 | ||
141 | 67 | ], | ||
142 | 68 | "../images/zoom-out.png": [ | ||
143 | 69 | 0, | ||
144 | 70 | -11966 | ||
145 | 71 | ], | ||
146 | 72 | "../images/purple-bar.png": [ | ||
147 | 73 | 0, | ||
148 | 74 | -15410 | ||
149 | 75 | ], | ||
150 | 76 | "../images/bullet.png": [ | ||
151 | 77 | 0, | ||
152 | 78 | -11638 | ||
153 | 79 | ], | ||
154 | 80 | "../images/info-large.png": [ | ||
155 | 81 | 0, | ||
156 | 82 | -17504 | ||
157 | 83 | ], | ||
158 | 84 | "../images/trash-logo.png": [ | ||
159 | 85 | 0, | ||
160 | 86 | -20340 | ||
161 | 87 | ], | ||
162 | 88 | "../images/warning.png": [ | ||
163 | 89 | 0, | ||
164 | 90 | -10162 | ||
165 | 91 | ], | ||
166 | 92 | "../images/mail.png": [ | ||
167 | 93 | 0, | ||
168 | 94 | -3932 | ||
169 | 95 | ], | ||
170 | 96 | "../images/build-failure.png": [ | ||
171 | 97 | 0, | ||
172 | 98 | -13606 | ||
173 | 99 | ], | ||
174 | 100 | "../images/branch-large.png": [ | ||
175 | 101 | 0, | ||
176 | 102 | -16230 | ||
177 | 103 | ], | ||
178 | 104 | "../images/download-large.png": [ | ||
179 | 105 | 0, | ||
180 | 106 | -17322 | ||
181 | 107 | ], | ||
182 | 108 | "../images/private-large.png": [ | ||
183 | 109 | 0, | ||
184 | 110 | -18232 | ||
185 | 111 | ], | ||
186 | 112 | "../images/launchpad-large.png": [ | ||
187 | 113 | 0, | ||
188 | 114 | -17686 | ||
189 | 115 | ], | ||
190 | 116 | "../images/translation-file.png": [ | ||
191 | 117 | 0, | ||
192 | 118 | -10818 | ||
193 | 119 | ], | ||
194 | 120 | "../images/source-package-recipe.png": [ | ||
195 | 121 | 0, | ||
196 | 122 | -12622 | ||
197 | 123 | ], | ||
198 | 124 | "../images/project-logo.png": [ | ||
199 | 125 | 0, | ||
200 | 126 | -18842 | ||
201 | 127 | ], | ||
202 | 128 | "../images/bug-medium.png": [ | ||
203 | 129 | 0, | ||
204 | 130 | -4752 | ||
205 | 131 | ], | ||
206 | 132 | "../images/architecture.png": [ | ||
207 | 133 | 0, | ||
208 | 134 | -12130 | ||
209 | 135 | ], | ||
210 | 136 | "../images/tour-icon": [ | ||
211 | 137 | 0, | ||
212 | 138 | -16066 | ||
213 | 139 | ], | ||
214 | 140 | "../images/trash-icon.png": [ | ||
215 | 141 | 0, | ||
216 | 142 | -11146 | ||
217 | 143 | ], | ||
218 | 144 | "../images/person-inactive.png": [ | ||
219 | 145 | 0, | ||
220 | 146 | -6722 | ||
221 | 147 | ], | ||
222 | 148 | "../images/arrowBottom.png": [ | ||
223 | 149 | 0, | ||
224 | 150 | -14754 | ||
225 | 151 | ], | ||
226 | 152 | "../images/project.png": [ | ||
227 | 153 | 0, | ||
228 | 154 | -9508 | ||
229 | 155 | ], | ||
230 | 156 | "../images/crowd.png": [ | ||
231 | 157 | 0, | ||
232 | 158 | -1640 | ||
233 | 159 | ], | ||
234 | 160 | "../images/info.png": [ | ||
235 | 161 | 0, | ||
236 | 162 | -492 | ||
237 | 163 | ], | ||
238 | 164 | "../images/flame-icon.png": [ | ||
239 | 165 | 0, | ||
240 | 166 | -7872 | ||
241 | 167 | ], | ||
242 | 168 | "../images/ubuntu-icon.png": [ | ||
243 | 169 | 0, | ||
244 | 170 | -6556 | ||
245 | 171 | ], | ||
246 | 172 | "../images/link.png": [ | ||
247 | 173 | 0, | ||
248 | 174 | -3768 | ||
249 | 175 | ], | ||
250 | 176 | "../images/person-logo.png": [ | ||
251 | 177 | 0, | ||
252 | 178 | -19270 | ||
253 | 179 | ], | ||
254 | 180 | "../images/distribution-logo.png": [ | ||
255 | 181 | 0, | ||
256 | 182 | -18628 | ||
257 | 183 | ], | ||
258 | 184 | "../images/retry.png": [ | ||
259 | 185 | 0, | ||
260 | 186 | -9020 | ||
261 | 187 | ], | ||
262 | 188 | "../images/rss.png": [ | ||
263 | 189 | 0, | ||
264 | 190 | -6392 | ||
265 | 191 | ], | ||
266 | 192 | "../images/private.png": [ | ||
267 | 193 | 0, | ||
268 | 194 | -10326 | ||
269 | 195 | ], | ||
270 | 196 | "../images/merge-proposal-icon.png": [ | ||
271 | 197 | 0, | ||
272 | 198 | -12950 | ||
273 | 199 | ], | ||
274 | 200 | "../images/download.png": [ | ||
275 | 201 | 0, | ||
276 | 202 | -984 | ||
277 | 203 | ], | ||
278 | 204 | "../images/arrowDown.png": [ | ||
279 | 205 | 0, | ||
280 | 206 | -14098 | ||
281 | 207 | ], | ||
282 | 208 | "../images/package-binary.png": [ | ||
283 | 209 | 0, | ||
284 | 210 | -8856 | ||
285 | 211 | ], | ||
286 | 212 | "../images/maybe.png": [ | ||
287 | 213 | 0, | ||
288 | 214 | -7212 | ||
289 | 215 | ], | ||
290 | 216 | "../images/bug-status-expand.png": [ | ||
291 | 217 | 0, | ||
292 | 218 | -12786 | ||
293 | 219 | ], | ||
294 | 220 | "../images/crowd-large.png": [ | ||
295 | 221 | 0, | ||
296 | 222 | -16594 | ||
297 | 223 | ], | ||
298 | 224 | "../images/blueprint.png": [ | ||
299 | 225 | 0, | ||
300 | 226 | -5244 | ||
301 | 227 | ], | ||
302 | 228 | "../images/project-badge.png": [ | ||
303 | 229 | 0, | ||
304 | 230 | -9346 | ||
305 | 231 | ], | ||
306 | 232 | "../images/bug-high.png": [ | ||
307 | 233 | 0, | ||
308 | 234 | -4588 | ||
309 | 235 | ], | ||
310 | 236 | "../images/blueprint-undefined.png": [ | ||
311 | 237 | 0, | ||
312 | 238 | -6064 | ||
313 | 239 | ], | ||
314 | 240 | "../images/blueprint-not.png": [ | ||
315 | 241 | 0, | ||
316 | 242 | -6228 | ||
317 | 243 | ], | ||
318 | 244 | "../images/stop.png": [ | ||
319 | 245 | 0, | ||
320 | 246 | -11310 | ||
321 | 247 | ], | ||
322 | 248 | "../images/flame-large.png": [ | ||
323 | 249 | 0, | ||
324 | 250 | -17140 | ||
325 | 251 | ], | ||
326 | 252 | "../images/bug-dupe-icon.png": [ | ||
327 | 253 | 0, | ||
328 | 254 | -8528 | ||
329 | 255 | ], | ||
330 | 256 | "../images/bug-critical.png": [ | ||
331 | 257 | 0, | ||
332 | 258 | -4424 | ||
333 | 259 | ], | ||
334 | 260 | "../images/build-success.png": [ | ||
335 | 261 | 0, | ||
336 | 262 | -13278 | ||
337 | 263 | ], | ||
338 | 264 | "../images/haspatch-icon.png": [ | ||
339 | 265 | 0, | ||
340 | 266 | -15902 | ||
341 | 267 | ], | ||
342 | 268 | "../images/person-inactive-badge.png": [ | ||
343 | 269 | 0, | ||
344 | 270 | -6886 | ||
345 | 271 | ], | ||
346 | 272 | "../images/ppa-icon.png": [ | ||
347 | 273 | 0, | ||
348 | 274 | -12294 | ||
349 | 275 | ], | ||
350 | 276 | "../images/yes.png": [ | ||
351 | 277 | 0, | ||
352 | 278 | -1476 | ||
353 | 279 | ], | ||
354 | 280 | "../images/team-logo.png": [ | ||
355 | 281 | 0, | ||
356 | 282 | -19698 | ||
357 | 283 | ], | ||
358 | 284 | "../images/arrowRight.png": [ | ||
359 | 285 | 0, | ||
360 | 286 | -2456 | ||
361 | 287 | ], | ||
362 | 288 | "../images/blueprint-high.png": [ | ||
363 | 289 | 0, | ||
364 | 290 | -5572 | ||
365 | 291 | ], | ||
366 | 292 | "../images/product.png": [ | ||
367 | 293 | 0, | ||
368 | 294 | -9834 | ||
369 | 295 | ], | ||
370 | 296 | "../images/bug-low.png": [ | ||
371 | 297 | 0, | ||
372 | 298 | -4916 | ||
373 | 299 | ], | ||
374 | 300 | "../images/package-source.png": [ | ||
375 | 301 | 0, | ||
376 | 302 | -3276 | ||
377 | 303 | ], | ||
378 | 304 | "../images/language.png": [ | ||
379 | 305 | 0, | ||
380 | 306 | -3604 | ||
381 | 307 | ], | ||
382 | 308 | "../images/person.png": [ | ||
383 | 309 | 0, | ||
384 | 310 | -1804 | ||
385 | 311 | ], | ||
386 | 312 | "../images/arrowUp.png": [ | ||
387 | 313 | 0, | ||
388 | 314 | -13934 | ||
389 | 315 | ], | ||
390 | 316 | "../images/distribution.png": [ | ||
391 | 317 | 0, | ||
392 | 318 | -3112 | ||
393 | 319 | ], | ||
394 | 320 | "../images/error-large.png": [ | ||
395 | 321 | 0, | ||
396 | 322 | -16958 | ||
397 | 323 | ], | ||
398 | 324 | "../images/news.png": [ | ||
399 | 325 | 0, | ||
400 | 326 | -15738 | ||
401 | 327 | ], | ||
402 | 328 | "../images/treeExpanded.png": [ | ||
403 | 329 | 0, | ||
404 | 330 | -2784 | ||
405 | 331 | ], | ||
406 | 332 | "../images/build-depwait.png": [ | ||
407 | 333 | 0, | ||
408 | 334 | -13770 | ||
409 | 335 | ], | ||
410 | 336 | "../images/blueprint-essential.png": [ | ||
411 | 337 | 0, | ||
412 | 338 | -5408 | ||
413 | 339 | ], | ||
414 | 340 | "../images/question.png": [ | ||
415 | 341 | 0, | ||
416 | 342 | -656 | ||
417 | 343 | ], | ||
418 | 344 | "../images/error.png": [ | ||
419 | 345 | 0, | ||
420 | 346 | -7376 | ||
421 | 347 | ], | ||
422 | 348 | "../images/bug-unknown.png": [ | ||
423 | 349 | 0, | ||
424 | 350 | -8364 | ||
425 | 351 | ], | ||
426 | 352 | "../images/product-logo.png": [ | ||
427 | 353 | 0, | ||
428 | 354 | -19056 | ||
429 | 355 | ], | ||
430 | 356 | "../images/blueprint-medium.png": [ | ||
431 | 357 | 0, | ||
432 | 358 | -5736 | ||
433 | 359 | ], | ||
434 | 360 | "../images/product-badge.png": [ | ||
435 | 361 | 0, | ||
436 | 362 | -9672 | ||
437 | 363 | ], | ||
438 | 364 | "../images/list.png": [ | ||
439 | 365 | 0, | ||
440 | 366 | -11474 | ||
441 | 367 | ], | ||
442 | 368 | "../images/launchpad-logo.png": [ | ||
443 | 369 | 0, | ||
444 | 370 | -18414 | ||
445 | 371 | ], | ||
446 | 372 | "../images/flame-logo.png": [ | ||
447 | 373 | 0, | ||
448 | 374 | -20126 | ||
449 | 375 | ], | ||
450 | 376 | "../images/translation-template.png": [ | ||
451 | 377 | 0, | ||
452 | 378 | -10982 | ||
453 | 379 | ], | ||
454 | 380 | "../images/bugtracker-icon.png": [ | ||
455 | 381 | 0, | ||
456 | 382 | -8692 | ||
457 | 383 | ], | ||
458 | 384 | "../images/meeting-logo.png": [ | ||
459 | 385 | 0, | ||
460 | 386 | -19912 | ||
461 | 387 | ], | ||
462 | 388 | "../images/treeCollapsed.png": [ | ||
463 | 389 | 0, | ||
464 | 390 | -2620 | ||
465 | 391 | ], | ||
466 | 392 | "../images/green-bar.png": [ | ||
467 | 393 | 0, | ||
468 | 394 | -15246 | ||
469 | 395 | ], | ||
470 | 396 | "../images/build-superseded.png": [ | ||
471 | 397 | 0, | ||
472 | 398 | -13114 | ||
473 | 399 | ], | ||
474 | 400 | "../images/trash-large.png": [ | ||
475 | 401 | 0, | ||
476 | 402 | -18050 | ||
477 | 403 | ], | ||
478 | 404 | "../images/red-bar.png": [ | ||
479 | 405 | 0, | ||
480 | 406 | -15574 | ||
481 | 407 | ], | ||
482 | 408 | "../images/add.png": [ | ||
483 | 409 | 0, | ||
484 | 410 | 0 | ||
485 | 411 | ], | ||
486 | 412 | "../images/remove.png": [ | ||
487 | 413 | 0, | ||
488 | 414 | -328 | ||
489 | 415 | ], | ||
490 | 416 | "../images/read-only.png": [ | ||
491 | 417 | 0, | ||
492 | 418 | -9998 | ||
493 | 419 | ], | ||
494 | 420 | "../images/person-inactive-logo.png": [ | ||
495 | 421 | 0, | ||
496 | 422 | -19484 | ||
497 | 423 | ], | ||
498 | 424 | "../images/edit.png": [ | ||
499 | 425 | 0, | ||
500 | 426 | -164 | ||
501 | 427 | ], | ||
502 | 428 | "../images/bug-wishlist.png": [ | ||
503 | 429 | 0, | ||
504 | 430 | -5080 | ||
505 | 431 | ], | ||
506 | 432 | "../images/warning-large.png": [ | ||
507 | 433 | 0, | ||
508 | 434 | -16412 | ||
509 | 435 | ], | ||
510 | 436 | "../images/arrowEnd.png": [ | ||
511 | 437 | 0, | ||
512 | 438 | -14426 | ||
513 | 439 | ], | ||
514 | 440 | "../images/cve.png": [ | ||
515 | 441 | 0, | ||
516 | 442 | -4096 | ||
517 | 443 | ], | ||
518 | 444 | "../images/notification-close.png": [ | ||
519 | 445 | 0, | ||
520 | 446 | -20725 | ||
521 | 447 | ], | ||
522 | 448 | "../images/merge-proposal-large.png": [ | ||
523 | 449 | 0, | ||
524 | 450 | -17868 | ||
525 | 451 | ], | ||
526 | 452 | "../images/branch.png": [ | ||
527 | 453 | 0, | ||
528 | 454 | -2948 | ||
529 | 455 | ], | ||
530 | 456 | "../images/person-badge.png": [ | ||
531 | 457 | 0, | ||
532 | 458 | -1968 | ||
533 | 459 | ], | ||
534 | 460 | "../images/notification-private.png": [ | ||
535 | 461 | 0, | ||
536 | 462 | -20554 | ||
537 | 463 | ], | ||
538 | 464 | "../images/bug.png": [ | ||
539 | 465 | 0, | ||
540 | 466 | -4260 | ||
541 | 467 | ], | ||
542 | 468 | "../images/bug-remote.png": [ | ||
543 | 469 | 0, | ||
544 | 470 | -8200 | ||
545 | 471 | ], | ||
546 | 472 | "../images/translation.png": [ | ||
547 | 473 | 0, | ||
548 | 474 | -10654 | ||
549 | 475 | ], | ||
550 | 476 | "../images/confirm.png": [ | ||
551 | 477 | 0, | ||
552 | 478 | -7706 | ||
553 | 479 | ], | ||
554 | 480 | "../images/search.png": [ | ||
555 | 481 | 0, | ||
556 | 482 | -1148 | ||
557 | 483 | ] | ||
558 | 484 | } | ||
559 | 485 | \ No newline at end of file | 0 | \ No newline at end of file |
560 | 486 | 1 | ||
561 | === modified file 'lib/lp/bugs/browser/structuralsubscription.py' | |||
562 | --- lib/lp/bugs/browser/structuralsubscription.py 2011-03-29 22:34:04 +0000 | |||
563 | +++ lib/lp/bugs/browser/structuralsubscription.py 2011-03-31 15:37:43 +0000 | |||
564 | @@ -58,6 +58,9 @@ | |||
565 | 58 | IStructuralSubscriptionForm, | 58 | IStructuralSubscriptionForm, |
566 | 59 | IStructuralSubscriptionTarget, | 59 | IStructuralSubscriptionTarget, |
567 | 60 | ) | 60 | ) |
568 | 61 | from lp.registry.interfaces.distribution import ( | ||
569 | 62 | IDistribution, | ||
570 | 63 | ) | ||
571 | 61 | from lp.registry.interfaces.distributionsourcepackage import ( | 64 | from lp.registry.interfaces.distributionsourcepackage import ( |
572 | 62 | IDistributionSourcePackage, | 65 | IDistributionSourcePackage, |
573 | 63 | ) | 66 | ) |
574 | @@ -376,7 +379,7 @@ | |||
575 | 376 | def expose_structural_subscription_data_to_js(context, request, | 379 | def expose_structural_subscription_data_to_js(context, request, |
576 | 377 | user, subscriptions=None): | 380 | user, subscriptions=None): |
577 | 378 | """Expose all of the data for a structural subscription to JavaScript.""" | 381 | """Expose all of the data for a structural subscription to JavaScript.""" |
579 | 379 | expose_user_administered_teams_to_js(request, user) | 382 | expose_user_administered_teams_to_js(request, user, context) |
580 | 380 | expose_enum_to_js(request, BugTaskImportance, 'importances') | 383 | expose_enum_to_js(request, BugTaskImportance, 'importances') |
581 | 381 | expose_enum_to_js(request, BugTaskStatus, 'statuses') | 384 | expose_enum_to_js(request, BugTaskStatus, 'statuses') |
582 | 382 | if subscriptions is None: | 385 | if subscriptions is None: |
583 | @@ -393,13 +396,20 @@ | |||
584 | 393 | IJSONRequestCache(request).objects[name] = info | 396 | IJSONRequestCache(request).objects[name] = info |
585 | 394 | 397 | ||
586 | 395 | 398 | ||
588 | 396 | def expose_user_administered_teams_to_js(request, user, | 399 | def expose_user_administered_teams_to_js(request, user, context, |
589 | 397 | absoluteURL=absoluteURL): | 400 | absoluteURL=absoluteURL): |
591 | 398 | """Make the list of teams the user adminsters available to JavaScript.""" | 401 | """Make the list of teams the user administers available to JavaScript.""" |
592 | 399 | info = [] | 402 | info = [] |
593 | 400 | api_request = IWebServiceClientRequest(request) | 403 | api_request = IWebServiceClientRequest(request) |
594 | 404 | is_distro = IDistribution.providedBy(context) | ||
595 | 401 | if user is not None: | 405 | if user is not None: |
596 | 402 | for team in user.getAdministratedTeams(): | 406 | for team in user.getAdministratedTeams(): |
597 | 407 | # If the context is a distro AND a bug supervisor is set AND | ||
598 | 408 | # the admininistered team is not a member of the bug supervisor | ||
599 | 409 | # team THEN skip it. | ||
600 | 410 | if (is_distro and context.bug_supervisor is not None and | ||
601 | 411 | not team.inTeam(context.bug_supervisor)): | ||
602 | 412 | continue | ||
603 | 403 | info.append({ | 413 | info.append({ |
604 | 404 | 'link': absoluteURL(team, api_request), | 414 | 'link': absoluteURL(team, api_request), |
605 | 405 | 'title': team.title, | 415 | 'title': team.title, |
606 | 406 | 416 | ||
607 | === modified file 'lib/lp/bugs/browser/tests/test_expose.py' | |||
608 | --- lib/lp/bugs/browser/tests/test_expose.py 2011-03-24 15:31:53 +0000 | |||
609 | +++ lib/lp/bugs/browser/tests/test_expose.py 2011-03-31 15:37:43 +0000 | |||
610 | @@ -3,6 +3,8 @@ | |||
611 | 3 | 3 | ||
612 | 4 | """Tests for helpers that expose data about a user to on-page JavaScript.""" | 4 | """Tests for helpers that expose data about a user to on-page JavaScript.""" |
613 | 5 | 5 | ||
614 | 6 | from operator import itemgetter | ||
615 | 7 | |||
616 | 6 | from lazr.enum import ( | 8 | from lazr.enum import ( |
617 | 7 | DBEnumeratedType, | 9 | DBEnumeratedType, |
618 | 8 | DBItem, | 10 | DBItem, |
619 | @@ -86,33 +88,126 @@ | |||
620 | 86 | return self.return_value | 88 | return self.return_value |
621 | 87 | 89 | ||
622 | 88 | 90 | ||
627 | 89 | class TestStructuralSubscriptionHelpers(TestCase): | 91 | class TestExposeAdministeredTeams(TestCaseWithFactory): |
628 | 90 | """Test the helpers used to add data that the on-page JS can use.""" | 92 | """Test the function to expose administered team.""" |
629 | 91 | 93 | ||
630 | 92 | def test_teams(self): | 94 | layer = DatabaseFunctionalLayer |
631 | 95 | |||
632 | 96 | def setUp(self): | ||
633 | 97 | super(TestExposeAdministeredTeams, self).setUp() | ||
634 | 98 | self.request = FakeRequest() | ||
635 | 99 | self.user = self.factory.makePerson() | ||
636 | 100 | |||
637 | 101 | def _setup_teams(self, owner): | ||
638 | 102 | self.bug_super_team = self.factory.makeTeam( | ||
639 | 103 | name='bug-supervisor-team', owner=owner) | ||
640 | 104 | bug_super_subteam = self.factory.makeTeam( | ||
641 | 105 | name='bug-supervisor-sub-team', owner=owner) | ||
642 | 106 | self.factory.makeTeam( | ||
643 | 107 | name='unrelated-team', owner=owner) | ||
644 | 108 | with person_logged_in(owner): | ||
645 | 109 | bug_super_subteam.join( | ||
646 | 110 | self.bug_super_team, self.bug_super_team.teamowner) | ||
647 | 111 | |||
648 | 112 | def _sort(self, team_info, key='title'): | ||
649 | 113 | return sorted(team_info, key=itemgetter(key)) | ||
650 | 114 | |||
651 | 115 | def test_teams_for_non_distro(self): | ||
652 | 93 | # The expose_user_administered_teams_to_js function loads some data | 116 | # The expose_user_administered_teams_to_js function loads some data |
653 | 94 | # about the teams the requesting user administers into the response to | 117 | # about the teams the requesting user administers into the response to |
654 | 95 | # be made available to JavaScript. | 118 | # be made available to JavaScript. |
655 | 96 | 119 | ||
659 | 97 | request = FakeRequest() | 120 | context = self.factory.makeProduct(owner=self.user) |
660 | 98 | user = FakeUser() | 121 | self._setup_teams(self.user) |
661 | 99 | expose_user_administered_teams_to_js(request, user, | 122 | |
662 | 123 | expose_user_administered_teams_to_js(self.request, self.user, context, | ||
663 | 100 | absoluteURL=fake_absoluteURL) | 124 | absoluteURL=fake_absoluteURL) |
664 | 101 | 125 | ||
665 | 102 | # The team information should have been added to the request. | 126 | # The team information should have been added to the request. |
669 | 103 | self.assertThat(request.objects, Contains('administratedTeams')) | 127 | self.assertThat(self.request.objects, Contains('administratedTeams')) |
670 | 104 | team_info = request.objects['administratedTeams'] | 128 | team_info = self._sort(self.request.objects['administratedTeams']) |
671 | 105 | # Since there are two (fake) teams, there should be two items in the | 129 | # Since there are three teams, there should be three items in the |
672 | 106 | # list of team info. | 130 | # list of team info. |
682 | 107 | self.assertThat(len(team_info), Equals(2)) | 131 | expected_number_teams = 3 |
683 | 108 | # The items info consist of a dictionary with link and title keys. | 132 | self.assertThat(len(team_info), Equals(expected_number_teams)) |
684 | 109 | self.assertThat(team_info[0], KeysEqual('link', 'title')) | 133 | # The items info consist of a dictionary with link and title keys. |
685 | 110 | self.assertThat(team_info[1], KeysEqual('link', 'title')) | 134 | for i in range(expected_number_teams): |
686 | 111 | # The link is the title of the team. | 135 | self.assertThat(team_info[i], KeysEqual('link', 'title')) |
687 | 112 | self.assertThat(team_info[0]['title'], Equals('Team One')) | 136 | # The link is the title of the team. |
688 | 113 | # The link is the API link to the team. | 137 | self.assertThat( |
689 | 114 | self.assertThat(team_info[0]['link'], | 138 | team_info[0]['title'], Equals(u'Bug Supervisor Sub Team')) |
690 | 115 | Equals('http://example.com/TeamOne')) | 139 | self.assertThat( |
691 | 140 | team_info[1]['title'], Equals(u'Bug Supervisor Team')) | ||
692 | 141 | self.assertThat( | ||
693 | 142 | team_info[2]['title'], Equals(u'Unrelated Team')) | ||
694 | 143 | # The link is the API link to the team. | ||
695 | 144 | self.assertThat(team_info[0]['link'], | ||
696 | 145 | Equals('http://example.com/BugSupervisorSubTeam')) | ||
697 | 146 | |||
698 | 147 | def test_teams_for_distro_with_bug_super(self): | ||
699 | 148 | self._setup_teams(self.user) | ||
700 | 149 | context = self.factory.makeDistribution( | ||
701 | 150 | owner=self.user, members=self.bug_super_team) | ||
702 | 151 | with person_logged_in(self.user): | ||
703 | 152 | context.setBugSupervisor( | ||
704 | 153 | self.bug_super_team, self.user) | ||
705 | 154 | |||
706 | 155 | expose_user_administered_teams_to_js(self.request, self.user, context, | ||
707 | 156 | absoluteURL=fake_absoluteURL) | ||
708 | 157 | |||
709 | 158 | # The team information should have been added to the request. | ||
710 | 159 | self.assertThat(self.request.objects, Contains('administratedTeams')) | ||
711 | 160 | team_info = self._sort(self.request.objects['administratedTeams']) | ||
712 | 161 | |||
713 | 162 | # Since the distro only returns teams that are members of the bug | ||
714 | 163 | # supervisor team, we only expect two. | ||
715 | 164 | expected_number_teams = 2 | ||
716 | 165 | self.assertThat(len(team_info), Equals(expected_number_teams)) | ||
717 | 166 | # The items info consist of a dictionary with link and title keys. | ||
718 | 167 | for i in range(expected_number_teams): | ||
719 | 168 | self.assertThat(team_info[i], KeysEqual('link', 'title')) | ||
720 | 169 | # The link is the title of the team. | ||
721 | 170 | self.assertThat( | ||
722 | 171 | team_info[0]['title'], Equals(u'Bug Supervisor Sub Team')) | ||
723 | 172 | self.assertThat( | ||
724 | 173 | team_info[1]['title'], Equals(u'Bug Supervisor Team')) | ||
725 | 174 | # The link is the API link to the team. | ||
726 | 175 | self.assertThat(team_info[0]['link'], | ||
727 | 176 | Equals('http://example.com/BugSupervisorSubTeam')) | ||
728 | 177 | |||
729 | 178 | def test_teams_for_distro_with_no_bug_super(self): | ||
730 | 179 | self._setup_teams(self.user) | ||
731 | 180 | context = self.factory.makeDistribution( | ||
732 | 181 | owner=self.user, members=self.bug_super_team) | ||
733 | 182 | |||
734 | 183 | expose_user_administered_teams_to_js(self.request, self.user, context, | ||
735 | 184 | absoluteURL=fake_absoluteURL) | ||
736 | 185 | |||
737 | 186 | # The team information should have been added to the request. | ||
738 | 187 | self.assertThat(self.request.objects, Contains('administratedTeams')) | ||
739 | 188 | team_info = self._sort(self.request.objects['administratedTeams']) | ||
740 | 189 | |||
741 | 190 | # Since the distro has no bug supervisor set, all administered teams | ||
742 | 191 | # are returned. | ||
743 | 192 | expected_number_teams = 3 | ||
744 | 193 | self.assertThat(len(team_info), Equals(expected_number_teams)) | ||
745 | 194 | # The items info consist of a dictionary with link and title keys. | ||
746 | 195 | for i in range(expected_number_teams): | ||
747 | 196 | self.assertThat(team_info[i], KeysEqual('link', 'title')) | ||
748 | 197 | # The link is the title of the team. | ||
749 | 198 | self.assertThat( | ||
750 | 199 | team_info[0]['title'], Equals(u'Bug Supervisor Sub Team')) | ||
751 | 200 | self.assertThat( | ||
752 | 201 | team_info[1]['title'], Equals(u'Bug Supervisor Team')) | ||
753 | 202 | self.assertThat( | ||
754 | 203 | team_info[2]['title'], Equals(u'Unrelated Team')) | ||
755 | 204 | # The link is the API link to the team. | ||
756 | 205 | self.assertThat(team_info[0]['link'], | ||
757 | 206 | Equals('http://example.com/BugSupervisorSubTeam')) | ||
758 | 207 | |||
759 | 208 | |||
760 | 209 | class TestStructuralSubscriptionHelpers(TestCase): | ||
761 | 210 | """Test the helpers used to add data that the on-page JS can use.""" | ||
762 | 116 | 211 | ||
763 | 117 | def test_expose_enum_to_js(self): | 212 | def test_expose_enum_to_js(self): |
764 | 118 | # Loads the titles of an enum into the response. | 213 | # Loads the titles of an enum into the response. |
This branch also removes icon-sprites. positioning from our tree as it is generated. The Makefile rules are updated to ensure it is built when needed.