Merge lp:~wgrant/launchpad/bug-1175212 into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16587
Proposed branch: lp:~wgrant/launchpad/bug-1175212
Merge into: lp:launchpad
Diff against target: 105 lines (+8/-31)
3 files modified
lib/lp/registry/browser/distributionsourcepackage.py (+0/-6)
lib/lp/registry/templates/distributionsourcepackage-index.pt (+7/-8)
lib/lp/soyuz/templates/archive-macros.pt (+1/-17)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-1175212
Reviewer Review Type Date Requested Status
Steve Kowalik (community) code Approve
Review via email: mp+161893@code.launchpad.net

Commit message

Rework Archive:+packages/DistributionSourcePackage:+index expanders to always use absolute URLs, and grab the URL from the node rather than calculating it.

Description of the change

DSP.latest_overall_publication doesn't count -proposed publications, so it's None if the package exists only in -proposed (common now that everything in Ubuntu goes through -proposed). This isn't a problem for most of the callsites, as they only care about its component and cope if it's None, but DSP:+index used the archive URL in its expanders. This branch fixes DSP:+index to always use the row's publication's archive URL, rather than the global DSP archive URL, unbreaking the expanders for packages that are only in -proposed.

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
2--- lib/lp/registry/browser/distributionsourcepackage.py 2012-11-26 08:33:03 +0000
3+++ lib/lp/registry/browser/distributionsourcepackage.py 2013-05-01 17:26:27 +0000
4@@ -21,7 +21,6 @@
5 import operator
6
7 from lazr.delegates import delegates
8-from lazr.restful.interfaces import IJSONRequestCache
9 from lazr.restful.utils import smartquote
10 from zope.component import (
11 adapter,
12@@ -328,11 +327,6 @@
13 expose_structural_subscription_data_to_js(
14 self.context, self.request, self.user)
15
16- pub = self.context.latest_overall_publication
17- if pub:
18- IJSONRequestCache(self.request).objects['archive_context_url'] = (
19- canonical_url(pub.archive, path_only_if_possible=True))
20-
21 @property
22 def label(self):
23 return self.context.title
24
25=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
26--- lib/lp/registry/templates/distributionsourcepackage-index.pt 2012-08-06 07:02:03 +0000
27+++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2013-05-01 17:26:27 +0000
28@@ -116,8 +116,7 @@
29 </div><!--yui-g -->
30
31
32- <div class="yui-u"
33- tal:define="archive context/latest_overall_publication/archive|nothing">
34+ <div class="yui-u">
35
36 <table class="listing" id="packages_list">
37 <tal:rows repeat="row view/version_table">
38@@ -144,13 +143,13 @@
39 </tal:title_row>
40
41 <tal:package_row condition="row/data_row">
42- <tal:define define="pubid row/publication/id">
43+ <tal:define define="pub row/publication">
44
45 <tr class="archive_package_row">
46 <td style="white-space: nowrap">
47 <a class="expander"
48- tal:attributes="id string:pub${pubid}-expander;
49- href string:${archive/fmt:url}/+sourcepub/${pubid}/+listing-archive-extra"></a>
50+ tal:attributes="id string:pub${pub/id}-expander;
51+ href string:${pub/archive/fmt:url}/+sourcepub/${pub/id}/+listing-archive-extra"></a>
52 <a tal:attributes="href row/version">
53 <img src="/@@/package-source" />
54 <tal:version content="row/version"/>
55@@ -169,10 +168,10 @@
56 content="string:(not published)"/>
57 </td>
58 </tr>
59- <tr tal:attributes="id string:pub${pubid}">
60+ <tr tal:attributes="id string:pub${pub/id}">
61 <td colspan="3">
62 <div class="package-details"
63- tal:attributes="id string:pub${pubid}-container"></div>
64+ tal:attributes="id string:pub${pub/id}-container"></div>
65 </td>
66 </tr>
67
68@@ -185,7 +184,7 @@
69
70 </tal:rows>
71 </table>
72- <metal:js use-macro="archive/@@+macros/expandable-table-js"/>
73+ <metal:js use-macro="context/distribution/main_archive/@@+macros/expandable-table-js"/>
74
75 </div>
76
77
78=== modified file 'lib/lp/soyuz/templates/archive-macros.pt'
79--- lib/lp/soyuz/templates/archive-macros.pt 2013-03-07 00:51:01 +0000
80+++ lib/lp/soyuz/templates/archive-macros.pt 2013-05-01 17:26:27 +0000
81@@ -56,23 +56,7 @@
82 }
83 };
84
85- /**
86- * If a page wants to use this outside of an archive context then it
87- * can define LP.cache['archive_context'], which should be a
88- * full or relative URL to the context archive page required.
89- */
90- var base_url = (
91- typeof(LP.cache['archive_context_url']) != "undefined")
92- ? LP.cache['archive_context_url']
93- : '';
94- if (base_url !== '') {
95- base_url += '/';
96- }
97- var pub_id = expander.content_node.get('id')
98- .replace('pub', '')
99- .replace('-container', '');
100- var uri = base_url + '+sourcepub/' + pub_id + '/+listing-archive-extra';
101- Y.io(uri, config);
102+ Y.io(expander.icon_node.get('href'), config);
103 }
104
105 /**