launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03142
[Merge] lp:~rvb/launchpad/dds-fix-localpackagediffs-745776 into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/dds-fix-localpackagediffs-745776 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #745776 in Launchpad itself: "+localpackagediffs shows latest published version, not the version in the DSD row"
https://bugs.launchpad.net/launchpad/+bug/745776
For more details, see:
https://code.launchpad.net/~rvb/launchpad/dds-fix-localpackagediffs-745776/+merge/55704
This branch fixes the display of the versions in the localpackagediffs page and the link to the sourcepackagerelease.
= Test =
{{{
./bin/test -cvv test_series_views test_diff_row_shows_version_attached
}}}
= 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://dogfood.launchpad.net/deribuntu/dangerous/+localpackagediffs)
--
https://code.launchpad.net/~rvb/launchpad/dds-fix-localpackagediffs-745776/+merge/55704
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/dds-fix-localpackagediffs-745776 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distroseriesdifference.py'
--- lib/lp/registry/browser/distroseriesdifference.py 2010-11-23 23:22:27 +0000
+++ lib/lp/registry/browser/distroseriesdifference.py 2011-03-31 12:33:45 +0000
@@ -27,15 +27,14 @@
)
from canonical.launchpad.webapp import (
+ canonical_url,
LaunchpadView,
Navigation,
stepthrough,
)
from canonical.launchpad.webapp.authorization import check_permission
from canonical.launchpad.webapp.launchpadform import custom_widget
-from lp.app.browser.launchpadform import (
- LaunchpadFormView,
- )
+from lp.app.browser.launchpadform import LaunchpadFormView
from lp.registry.enum import DistroSeriesDifferenceStatus
from lp.registry.interfaces.distroseriesdifference import (
IDistroSeriesDifference,
@@ -51,6 +50,9 @@
IComment,
IConversation,
)
+from lp.soyuz.model.distroseriessourcepackagerelease import (
+ DistroSeriesSourcePackageRelease,
+ )
class DistroSeriesDifferenceNavigation(Navigation):
@@ -67,6 +69,34 @@
IDistroSeriesDifferenceCommentSource).getForDifference(
self.context, id)
+ @property
+ def parent_source_package_url(self):
+ return self._package_url(parent=True)
+
+ @property
+ def source_package_url(self):
+ return self._package_url()
+
+ def _package_url(self, parent=False):
+ if parent:
+ distro_series = self.context.derived_series.parent_series
+ version = self.context.parent_source_version
+ else:
+ distro_series = self.context.derived_series
+ version = self.context.source_version
+
+ pubs = distro_series.getPublishedSources(
+ self.context.source_package_name, include_pending=True,
+ version=version)
+
+ try:
+ url = canonical_url(
+ DistroSeriesSourcePackageRelease(
+ distro_series, pubs[0].sourcepackagerelease))
+ return url
+ except IndexError:
+ return ''
+
class IDistroSeriesDifferenceForm(Interface):
"""An interface used in the browser only for displaying form elements."""
=== modified file 'lib/lp/registry/browser/tests/test_series_views.py'
--- lib/lp/registry/browser/tests/test_series_views.py 2011-03-29 18:09:43 +0000
+++ lib/lp/registry/browser/tests/test_series_views.py 2011-03-31 12:33:45 +0000
@@ -8,8 +8,6 @@
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
-import unittest
-
from canonical.config import config
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.testing.pages import find_tag_by_id
@@ -17,32 +15,30 @@
from canonical.launchpad.webapp.publisher import canonical_url
from canonical.testing.layers import (
DatabaseFunctionalLayer,
+ LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
- LaunchpadFunctionalLayer,
)
from lp.registry.enum import (
DistroSeriesDifferenceStatus,
DistroSeriesDifferenceType,
)
+from lp.services.features import (
+ getFeatureFlag,
+ install_feature_controller,
+ )
from lp.services.features.flags import FeatureController
from lp.services.features.model import (
FeatureFlag,
getFeatureStore,
)
-from lp.services.features import (
- getFeatureFlag,
- install_feature_controller,
- )
+from lp.soyuz.enums import SourcePackageFormat
from lp.soyuz.interfaces.sourcepackageformat import (
ISourcePackageFormatSelectionSet,
)
-from lp.soyuz.enums import (
- SourcePackageFormat,
- )
from lp.testing import (
- TestCaseWithFactory,
login_person,
person_logged_in,
+ TestCaseWithFactory,
)
from lp.testing.views import create_initialized_view
@@ -268,6 +264,53 @@
self.assertEqual(1, len(links))
self.assertEqual(difference.source_package_name.name, links[0].string)
+ def test_diff_row_shows_version_attached(self):
+ # The +localpackagediffs page shows the version attached to the
+ # DSD and not the last published version (bug=745776).
+ package_name = 'package-1'
+ derived_series = self.factory.makeDistroSeries(
+ name='derilucid', parent_series=self.factory.makeDistroSeries(
+ name='lucid'))
+ versions = {
+ 'base': u'1.0',
+ 'derived': u'1.0derived1',
+ 'parent': u'1.0-1',
+ }
+ new_version = u'1.2'
+
+ difference = self.factory.makeDistroSeriesDifference(
+ versions=versions,
+ source_package_name_str=package_name,
+ derived_series=derived_series)
+
+ # Create a more recent source package publishing history.
+ sourcepackagename = self.factory.getOrMakeSourcePackageName(
+ package_name)
+ self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=sourcepackagename,
+ distroseries=derived_series,
+ version=new_version)
+
+ set_derived_series_ui_feature_flag(self)
+ view = create_initialized_view(
+ derived_series, '+localpackagediffs')
+ soup = BeautifulSoup(view())
+ diff_table = soup.find('table', {'class': 'listing'})
+ row = diff_table.tbody.findAll('tr')[0]
+ links = row.findAll('a', {'class': 'derived-version'})
+
+ # The version displayed is the version attached to the
+ # difference.
+ self.assertEqual(1, len(links))
+ self.assertEqual(versions['derived'], links[0].string.strip())
+
+ link = canonical_url(difference.source_pub.sourcepackagerelease)
+ self.assertTrue(link.endswith(new_version))
+ # The link points to the sourcepackagerelease referenced in the
+ # difference.
+ self.assertTrue(
+ links[0].get('href').endswith(difference.source_version))
+
class DistroSeriesLocalPackageDiffsFunctionalTestCase(TestCaseWithFactory):
@@ -504,7 +547,3 @@
for item in view.milestone_batch_navigator.currentBatch()]
self.assertEqual(expected, milestone_names)
config.pop('default-batch-size')
-
-
-def test_suite():
- return unittest.TestLoader().loadTestsFromName(__name__)
=== modified file 'lib/lp/registry/templates/distroseries-localdifferences.pt'
--- lib/lp/registry/templates/distroseries-localdifferences.pt 2011-03-23 16:28:51 +0000
+++ lib/lp/registry/templates/distroseries-localdifferences.pt 2011-03-31 12:33:45 +0000
@@ -66,14 +66,15 @@
<a tal:attributes="href difference/fmt:url" class="toggle-extra"
tal:content="parent_source_pub/source_package_name">Foo</a>
</td>
- <td><a tal:attributes="href parent_source_pub/sourcepackagerelease/fmt:url">
+ <td><a tal:attributes="href difference/@@/parent_source_package_url"
+ class="parent_version">
<tal:replace
- replace="parent_source_pub/sourcepackagerelease/version"/></a>
+ replace="difference/parent_source_version"/></a>
</td>
- <td><a tal:attributes="href source_pub/sourcepackagerelease/fmt:url"
+ <td><a tal:attributes="href difference/@@/source_package_url"
class="derived-version">
<tal:replace
- replace="source_pub/sourcepackagerelease/version"/></a>
+ replace="difference/source_version"/></a>
</td>
<td>
<span tal:attributes="title difference/source_pub/datepublished/fmt:datetime"