Merge lp:~jpds/launchpad/fix_518385 into lp:launchpad

Proposed by Jonathan Davies on 2010-02-07
Status: Rejected
Rejected by: Curtis Hovey on 2010-03-09
Proposed branch: lp:~jpds/launchpad/fix_518385
Merge into: lp:launchpad
Prerequisite: lp:~jpds/launchpad/fix_518232
Diff against target: 185 lines (+69/-9)
5 files modified
lib/lp/registry/browser/tests/distributionmirror-views.txt (+46/-5)
lib/lp/registry/doc/distribution-mirror.txt (+2/-0)
lib/lp/registry/interfaces/distributionmirror.py (+8/-4)
lib/lp/registry/model/distributionmirror.py (+6/-0)
lib/lp/registry/templates/distributionmirror-index.pt (+7/-0)
To merge this branch: bzr merge lp:~jpds/launchpad/fix_518385
Reviewer Review Type Date Requested Status
Canonical Launchpad Engineering ui 2010-02-07 Pending
Canonical Launchpad Engineering code 2010-02-07 Pending
Review via email: mp+18812@code.launchpad.net

Commit Message

Mark mirrors which are not official_candidates or official as private on the web UI.

To post a comment you must log in.
Jonathan Davies (jpds) wrote :

= Summary =

Sometimes we have mirror admins who do not tick the "Apply to be an official mirror of this distribution" check box.

Mirrors which are not official_candidates or official should be marked as such with an IPrivacy layout on the web UI.

A UI example can be found at:

- http://people.canonical.com/~jpds/fix_518385.png

This branch builds on the new distributionmirror interface set up and thus needs lp:~jpds/launchpad/fix_518232 merged first.

= UI Testing =

Login as karl@c.c and visit these URLs:

 * https://launchpad.dev/ubuntu/+mirror/invalid-mirror
 * https://launchpad.dev/ubuntu/+mirror/archive-404-mirror - change details and unmark "Apply to be an official mirror of this distribution".

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/registry/browser/tests/distributionmirror-views.txt
  lib/lp/registry/doc/distribution-mirror.txt
  lib/lp/registry/interfaces/distributionmirror.py
  lib/lp/registry/model/distributionmirror.py
  lib/lp/registry/templates/distributionmirror-index.pt

Aaron Bentley (abentley) wrote :

I'm not comfortable reviewing this, because there's no pre-implementation call. It would also if the bug had been triaged or confirmed by someone from registry.

Brad Crittenden (bac) wrote :

Thank you Aaron, that is exactly the right response.

Jonathan I'm available to do a better-late-than-never pre-imp call/chat with you.

Graham Binns (gmb) wrote :

Hi Jonathan, Brad;

Has there been a pre/post-imp call / chat for this yet? If not I'm happy to make myself available for one.

Graham Binns (gmb) wrote :

Hi Jonathan,

Has there been any movement on this? You need to have a pre/post imp discussion about this branch before we can land it. I'm willing to make myself available this afternoon for one.

If you don't have time to have a discussion about this branch at the moment then I'll mark the merge proposal as rejected and you can resubmit it once you've had time to talk it over with someone (this is no reflection on you, but it's sitting at the top of the active reviews queue in an irritating fashion).

Graham Binns (gmb) wrote :

In fact, I'm going to mark this was WIP pending the pre-imp discussion.

Unmerged revisions

10301. By Jonathan Davies on 2010-02-07

Display the fact that a mirror registration is private but not why.

10300. By Jonathan Davies on 2010-02-07

Fixed indent for private docstring.

10299. By Jonathan Davies on 2010-02-07

Updated tests for new private information portlets.

10298. By Jonathan Davies on 2010-02-07

Give the privacy boxes different IDs for tests.

10297. By Jonathan Davies on 2010-02-07

Ensure that newly registered mirrors are private.

10296. By Jonathan Davies on 2010-02-07

Moved all_probe_records and last_probe_record down to IDistributionMirrorPublic
as IPrivacy seems to be making it upset.

10295. By Jonathan Davies on 2010-02-07

Docstring for private()

10294. By Jonathan Davies on 2010-02-07

Finalize private portlet conditions.

10293. By Jonathan Davies on 2010-02-07

Display private portlet's on mirror pages explaining why the mirror in question
has been marked as private.

10292. By Jonathan Davies on 2010-02-07

Implemented an IPrivacy layer to DistributionMirror.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/tests/distributionmirror-views.txt'
2--- lib/lp/registry/browser/tests/distributionmirror-views.txt 2009-12-14 15:22:53 +0000
3+++ lib/lp/registry/browser/tests/distributionmirror-views.txt 2010-02-07 23:03:20 +0000
4@@ -149,6 +149,8 @@
5
6 >>> print mirror.status.name
7 PENDING_REVIEW
8+ >>> print mirror.private
9+ True
10 >>> print mirror.date_reviewed, mirror.reviewer
11 None None
12
13@@ -195,6 +197,8 @@
14
15 >>> print mirror.status.name
16 OFFICIAL
17+ >>> print mirror.private
18+ False
19 >>> print mirror.reviewer.name
20 karl
21 >>> print mirror.whiteboard
22@@ -413,23 +417,60 @@
23 The Hoary Hedgehog Release Ubuntu, Edubuntu
24 The Warty Warthog Release Ubuntu, Kubuntu
25
26-Mirror admins can also see a whiteboard
27+Mirror admins can also see a whiteboard:
28
29 >>> login('karl@canonical.com')
30- >>> user = getUtility(ILaunchBag).user
31+ >>> karl_user = getUtility(ILaunchBag).user
32 >>> cd_mirror.whiteboard = 'This is a good mirror.'
33 >>> view = create_initialized_view(
34- ... cd_mirror, '+index', principal=user)
35+ ... cd_mirror, '+index', principal=karl_user)
36 >>> whiteboard = find_tag_by_id(view.render(), 'whiteboard')
37 >>> print extract_text(whiteboard.find('dd'))
38 This is a good mirror.
39
40 >>> login('no-priv@canonical.com')
41- >>> user = getUtility(ILaunchBag).user
42+ >>> no_priv_user = getUtility(ILaunchBag).user
43 >>> view = create_initialized_view(
44- ... cd_mirror, '+index', principal=user)
45+ ... cd_mirror, '+index', principal=no_priv_user)
46 >>> print find_tag_by_id(view.render(), 'whiteboard')
47 None
48+
49+And extra private information portlets:
50+
51+ >>> login('karl@canonical.com')
52+ >>> karl_user = getUtility(ILaunchBag).user
53+
54+ >>> releases_mirror = ubuntu.getMirrorByName('random-releases-mirror')
55+ >>> form = dict(form)
56+ >>> form['field.official_candidate'] = 'off'
57+ >>> form['field.actions.save'] = 'Save'
58+ >>> view = create_initialized_view(
59+ ... releases_mirror, '+edit', form=form, principal=karl_user)
60+ >>> view.errors
61+ []
62+
63+ >>> index_view = create_initialized_view(
64+ ... releases_mirror, '+index', principal=karl_user)
65+ >>> print extract_text(find_tag_by_id(index_view.render(),
66+ ... 'privacy'))
67+ Mirror registration viewing restricted to adminstration
68+ and not publicly indexed.
69+
70+ >>> form = dict(form)
71+ >>> form['field.official_candidate'] = 'on'
72+ >>> form['field.status'] = 'UNOFFICIAL'
73+ >>> form['field.actions.save'] = 'Save'
74+ >>> view = create_initialized_view(
75+ ... releases_mirror, '+review', form=form, principal=karl_user)
76+ >>> view.errors
77+ []
78+
79+ >>> index_view = create_initialized_view(
80+ ... releases_mirror, '+index', principal=karl_user)
81+ >>> print extract_text(find_tag_by_id(index_view.render(),
82+ ... 'privacy'))
83+ Mirror registration viewing restricted to adminstration
84+ and not publicly indexed.
85
86
87 Distribution mirror RSS
88
89=== modified file 'lib/lp/registry/doc/distribution-mirror.txt'
90--- lib/lp/registry/doc/distribution-mirror.txt 2009-12-09 10:03:20 +0000
91+++ lib/lp/registry/doc/distribution-mirror.txt 2010-02-07 23:03:20 +0000
92@@ -34,6 +34,8 @@
93
94 >>> new_mirror.isOfficial()
95 False
96+ >>> new_mirror.private
97+ True
98 >>> new_mirror.status
99 <DBItem MirrorStatus.PENDING_REVIEW...
100
101
102=== modified file 'lib/lp/registry/interfaces/distributionmirror.py'
103--- lib/lp/registry/interfaces/distributionmirror.py 2010-02-07 23:03:19 +0000
104+++ lib/lp/registry/interfaces/distributionmirror.py 2010-02-07 23:03:20 +0000
105@@ -37,6 +37,7 @@
106 from canonical.launchpad import _
107 from canonical.launchpad.fields import (
108 ContentNameField, PublicPersonChoice, URIField, Whiteboard)
109+from canonical.launchpad.interfaces.launchpad import IPrivacy
110 from canonical.launchpad.validators.name import name_validator
111 from canonical.launchpad.validators import LaunchpadValidationError
112 from canonical.launchpad.webapp.menu import structured
113@@ -302,16 +303,13 @@
114 official_candidate = exported(Bool(
115 title=_('Apply to be an official mirror of this distribution'),
116 required=False, readonly=False, default=True))
117- last_probe_record = Attribute(
118- 'The last MirrorProbeRecord for this mirror.')
119- all_probe_records = Attribute('All MirrorProbeRecords for this mirror.')
120 whiteboard = exported(Whiteboard(
121 title=_('Whiteboard'), required=False, readonly=False,
122 description=_("Notes on the current status of the mirror (only "
123 "visible to admins and the mirror's registrant).")))
124
125
126-class IDistributionMirrorPublic(Interface):
127+class IDistributionMirrorPublic(Interface, IPrivacy):
128 """Public IDistributionMirror properties."""
129
130 id = Int(title=_('The unique id'), required=True, readonly=True)
131@@ -377,6 +375,9 @@
132 source_series = Attribute(
133 'All MirrorDistroSeriesSources of this mirror')
134 arch_series = Attribute('All MirrorDistroArchSeries of this mirror')
135+ last_probe_record = Attribute(
136+ 'The last MirrorProbeRecord for this mirror.')
137+ all_probe_records = Attribute('All MirrorProbeRecords for this mirror.')
138 has_ftp_or_rsync_base_url = Bool(
139 title=_('Does this mirror have a FTP or Rsync base URL?'))
140 base_url = Attribute('The HTTP or FTP base URL of this mirror')
141@@ -570,6 +571,9 @@
142 def getByRsyncUrl(url):
143 """Return the mirror with the given Rsync URL or None."""
144
145+ def private():
146+ """Return True is the mirror is not an official candidate."""
147+
148
149 class IMirrorDistroArchSeries(Interface):
150 """The mirror of the packages of a given Distro Arch Series"""
151
152=== modified file 'lib/lp/registry/model/distributionmirror.py'
153--- lib/lp/registry/model/distributionmirror.py 2009-10-26 18:40:04 +0000
154+++ lib/lp/registry/model/distributionmirror.py 2010-02-07 23:03:20 +0000
155@@ -392,6 +392,12 @@
156 paths.append((series, pocket, component, path))
157 return paths
158
159+ @property
160+ def private(self):
161+ """See IDistributionMirror."""
162+ return (not self.official_candidate
163+ or self.status != MirrorStatus.OFFICIAL)
164+
165
166 class DistributionMirrorSet:
167 """See IDistributionMirrorSet"""
168
169=== modified file 'lib/lp/registry/templates/distributionmirror-index.pt'
170--- lib/lp/registry/templates/distributionmirror-index.pt 2009-12-08 15:51:34 +0000
171+++ lib/lp/registry/templates/distributionmirror-index.pt 2010-02-07 23:03:20 +0000
172@@ -148,6 +148,13 @@
173 </tal:main>
174
175 <tal:side metal:fill-slot="side" condition="context/required:launchpad.Edit">
176+ <div id="privacy" class="portlet private"
177+ tal:condition="context/private">
178+ <span class="sprite private">
179+ Mirror registration viewing <strong>restricted</strong> to adminstration
180+ and not publicly indexed.
181+ </span>
182+ </div>
183 <tal:menu replace="structure context/@@+global-actions" />
184 </tal:side>
185 </body>