Merge lp:~rvb/launchpad/dds-fix-localpackagediffs-745776 into lp:launchpad
Proposed by
Raphaël Badin
Status: | Merged |
---|---|
Approved by: | Julian Edwards |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12727 |
Proposed branch: | lp:~rvb/launchpad/dds-fix-localpackagediffs-745776 |
Merge into: | lp:launchpad |
Diff against target: |
311 lines (+163/-28) 5 files modified
lib/lp/registry/browser/distroseriesdifference.py (+36/-3) lib/lp/registry/browser/tests/test_series_views.py (+99/-14) lib/lp/registry/interfaces/distroseries.py (+2/-0) lib/lp/registry/model/distroseries.py (+2/-0) lib/lp/registry/templates/distroseries-localdifferences.pt (+24/-11) |
To merge this branch: | bzr merge lp:~rvb/launchpad/dds-fix-localpackagediffs-745776 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julian Edwards (community) | Approve | ||
Gavin Panella (community) | Approve | ||
Review via email: mp+55704@code.launchpad.net |
Commit message
[r=allenap,
Description of the change
This branch fixes the display of the versions in the localpackagediffs page and the link to the sourcepackagere
= Test =
{{{
./bin/test -cvv test_series_views test_diff_
}}}
= QA =
Check that the versions displayed in the localpackagediff page's table are consistent with the version displayed in the details of the difference.
(https:/
To post a comment you must log in.
Lovely. A few minor comments.
[1]
+ @property source_ package_ url(self) : url(parent= True) package_ url(self) : derived_ series. parent_ series parent_ source_ version derived_ series source_ version
+ def parent_
+ return self._package_
+
+ @property
+ def source_
+ return self._package_url()
+
+ def _package_url(self, parent=False):
+ if parent:
+ distro_series = self.context.
+ version = self.context.
+ else:
+ distro_series = self.context.
+ version = self.context.
You could get one less level of indirection if you pass distro_series
and version into _package_url():
@property source_ package_ url(self) :
self. context. derived_ series. parent_ series,
self. context. parent_ source_ version)
def parent_
return self._package_url(
@property package_ url(self) :
self. context. derived_ series,
self. context. source_ version)
def source_
return self._package_url(
def _package_url(self, distro_series, version):
...
But this is entirely up to you; it's fine as it is.
[2]
+ try: rcePackageRelea se( .sourcepackager elease) )
+ url = canonical_url(
+ DistroSeriesSou
+ distro_series, pubs[0]
+ return url
+ except IndexError:
+ return ''
I assume you're attempting to catch any potential IndexErrors raised
by pubs[0], but it will also catch IndexError in any of the called
code.
Now pubs will be an SQLObjectResultSet, so you could do the following:
from storm.zope. interfaces import IResultSet
pub = IResultSet( pubs).first( )
DistroSeriesS ourcePackageRel ease(
distro_ series, pub.sourcepacka gerelease) )
if pub is None:
return ''
else:
return canonical_url(
Out of interest, why do you only consider the first publication here?
[3]
+ row = diff_table. tbody.findAll( 'tr')[0]
This could simplified to:
row = diff_table.tbody.tr
[4]
+ self.assertTrue (link.endswith( new_version) ) .get('href' ).endswith( difference. source_ version) )
...
+ self.assertTrue(
+ links[0]
In the event of a failure, you could make the report more informative
by using the EndsWith matcher:
from testtools.matchers import EndsWith assertTrue( link, EndsWith( new_version) )
self.