Merge lp:~nigelbabu/launchpad/logo-links-713873 into lp:launchpad

Proposed by Nigel Babu
Status: Rejected
Rejected by: Curtis Hovey
Proposed branch: lp:~nigelbabu/launchpad/logo-links-713873
Merge into: lp:launchpad
Diff against target: 45 lines (+24/-0)
2 files modified
lib/lp/registry/interfaces/person.py (+16/-0)
lib/lp/registry/model/person.py (+8/-0)
To merge this branch: bzr merge lp:~nigelbabu/launchpad/logo-links-713873
Reviewer Review Type Date Requested Status
Curtis Hovey (community) Disapprove
Raphaël Badin (community) Needs Fixing
Review via email: mp+88631@code.launchpad.net

Description of the change

Add a method to person to print the logo and mugshot urls directly

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Hi Nigel, sorry for the late review. Like you said on IRC, you need to test the new methods (see the existing API tests for person in ./lib/lp/registry/browser/tests/test_person_webservice.py). In the current state, I'm afraid the LibraryFileAlias object returned by self.mugshot won't be converted into json and the call to person.getMugshotUrl() will fail.

BTW, to test this manually:
- setup a local instance
- log in and change the mugshot for the test user
- use the api to call the new method: http://paste.ubuntu.com/806227/

I'm marking this as needs fixing.

review: Needs Fixing
Revision history for this message
Curtis Hovey (sinzui) wrote :

I am rejecting this branch because a lot more work is needed to address this bug. As can be seeing lib/lp/app/browser/tales.py, getting the URL for a logo or mugshot is not simple. The proposed interface changes are fine. The implementation would need to move the URL logic from tales.py into the model. And any changes will need to be tested.

review: Disapprove

Unmerged revisions

14677. By Nigel Babu

Return the url of mugshot and logo directly

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/interfaces/person.py'
2--- lib/lp/registry/interfaces/person.py 2011-12-30 06:14:56 +0000
3+++ lib/lp/registry/interfaces/person.py 2012-01-16 01:28:24 +0000
4@@ -757,6 +757,22 @@
5 :return: a PPA `IArchive` record corresponding to the name.
6 """
7
8+ @export_read_operation()
9+ @operation_for_version("beta")
10+ def getLogoUrl():
11+ """Return link to logo.
12+
13+ :return: The link to logo.
14+ """
15+
16+ @export_read_operation()
17+ @operation_for_version("beta")
18+ def getMugshotUrl():
19+ """Return link to mugshot.
20+
21+ :return: The link to mugshot.
22+ """
23+
24
25 class IPersonViewRestricted(IHasBranches, IHasSpecifications,
26 IHasMergeProposals, IHasMugshot,
27
28=== modified file 'lib/lp/registry/model/person.py'
29--- lib/lp/registry/model/person.py 2012-01-12 08:13:59 +0000
30+++ lib/lp/registry/model/person.py 2012-01-16 01:28:24 +0000
31@@ -3055,6 +3055,14 @@
32 def canCreatePPA(self):
33 """See `IPerson.`"""
34 return self.subscriptionpolicy in CLOSED_TEAM_POLICY
35+
36+ def getLogoUrl(self):
37+ """See `IPerson.`"""
38+ return self.logo
39+
40+ def getMugshotUrl(self):
41+ """See `IPerson.`"""
42+ return self.mugshot
43
44
45 class PersonSet: