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
=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py 2012-11-26 08:33:03 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py 2013-05-01 17:26:27 +0000
@@ -21,7 +21,6 @@
21import operator21import operator
2222
23from lazr.delegates import delegates23from lazr.delegates import delegates
24from lazr.restful.interfaces import IJSONRequestCache
25from lazr.restful.utils import smartquote24from lazr.restful.utils import smartquote
26from zope.component import (25from zope.component import (
27 adapter,26 adapter,
@@ -328,11 +327,6 @@
328 expose_structural_subscription_data_to_js(327 expose_structural_subscription_data_to_js(
329 self.context, self.request, self.user)328 self.context, self.request, self.user)
330329
331 pub = self.context.latest_overall_publication
332 if pub:
333 IJSONRequestCache(self.request).objects['archive_context_url'] = (
334 canonical_url(pub.archive, path_only_if_possible=True))
335
336 @property330 @property
337 def label(self):331 def label(self):
338 return self.context.title332 return self.context.title
339333
=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
--- lib/lp/registry/templates/distributionsourcepackage-index.pt 2012-08-06 07:02:03 +0000
+++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2013-05-01 17:26:27 +0000
@@ -116,8 +116,7 @@
116 </div><!--yui-g -->116 </div><!--yui-g -->
117117
118118
119 <div class="yui-u"119 <div class="yui-u">
120 tal:define="archive context/latest_overall_publication/archive|nothing">
121120
122 <table class="listing" id="packages_list">121 <table class="listing" id="packages_list">
123 <tal:rows repeat="row view/version_table">122 <tal:rows repeat="row view/version_table">
@@ -144,13 +143,13 @@
144 </tal:title_row>143 </tal:title_row>
145144
146 <tal:package_row condition="row/data_row">145 <tal:package_row condition="row/data_row">
147 <tal:define define="pubid row/publication/id">146 <tal:define define="pub row/publication">
148147
149 <tr class="archive_package_row">148 <tr class="archive_package_row">
150 <td style="white-space: nowrap">149 <td style="white-space: nowrap">
151 <a class="expander"150 <a class="expander"
152 tal:attributes="id string:pub${pubid}-expander;151 tal:attributes="id string:pub${pub/id}-expander;
153 href string:${archive/fmt:url}/+sourcepub/${pubid}/+listing-archive-extra"></a>152 href string:${pub/archive/fmt:url}/+sourcepub/${pub/id}/+listing-archive-extra"></a>
154 <a tal:attributes="href row/version">153 <a tal:attributes="href row/version">
155 <img src="/@@/package-source" />154 <img src="/@@/package-source" />
156 <tal:version content="row/version"/>155 <tal:version content="row/version"/>
@@ -169,10 +168,10 @@
169 content="string:(not published)"/>168 content="string:(not published)"/>
170 </td>169 </td>
171 </tr>170 </tr>
172 <tr tal:attributes="id string:pub${pubid}">171 <tr tal:attributes="id string:pub${pub/id}">
173 <td colspan="3">172 <td colspan="3">
174 <div class="package-details"173 <div class="package-details"
175 tal:attributes="id string:pub${pubid}-container"></div>174 tal:attributes="id string:pub${pub/id}-container"></div>
176 </td>175 </td>
177 </tr>176 </tr>
178177
@@ -185,7 +184,7 @@
185184
186 </tal:rows>185 </tal:rows>
187 </table>186 </table>
188 <metal:js use-macro="archive/@@+macros/expandable-table-js"/>187 <metal:js use-macro="context/distribution/main_archive/@@+macros/expandable-table-js"/>
189188
190 </div>189 </div>
191190
192191
=== modified file 'lib/lp/soyuz/templates/archive-macros.pt'
--- lib/lp/soyuz/templates/archive-macros.pt 2013-03-07 00:51:01 +0000
+++ lib/lp/soyuz/templates/archive-macros.pt 2013-05-01 17:26:27 +0000
@@ -56,23 +56,7 @@
56 }56 }
57 };57 };
5858
59 /**59 Y.io(expander.icon_node.get('href'), config);
60 * If a page wants to use this outside of an archive context then it
61 * can define LP.cache['archive_context'], which should be a
62 * full or relative URL to the context archive page required.
63 */
64 var base_url = (
65 typeof(LP.cache['archive_context_url']) != "undefined")
66 ? LP.cache['archive_context_url']
67 : '';
68 if (base_url !== '') {
69 base_url += '/';
70 }
71 var pub_id = expander.content_node.get('id')
72 .replace('pub', '')
73 .replace('-container', '');
74 var uri = base_url + '+sourcepub/' + pub_id + '/+listing-archive-extra';
75 Y.io(uri, config);
76}60}
7761
78/**62/**