launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04066
[Merge] lp:~rvb/launchpad/sync-bug-785613 into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/sync-bug-785613 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #785613 in Launchpad itself: ""No packages selected" on later pages"
https://bugs.launchpad.net/launchpad/+bug/785613
For more details, see:
https://code.launchpad.net/~rvb/launchpad/sync-bug-785613/+merge/66026
This branch fixes the difference pages so that the form on these pages self-post. The trick is to add the query_string to the POST address.
= Tests =
./bin/test -cvv test_distroseries test_diff_view_action_url
= Q/A =
Synchronizing a package on the second page of the batch should be possible.
--
https://code.launchpad.net/~rvb/launchpad/sync-bug-785613/+merge/66026
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/sync-bug-785613 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py 2011-06-27 16:42:35 +0000
+++ lib/lp/registry/browser/distroseries.py 2011-06-27 16:46:21 +0000
@@ -879,6 +879,13 @@
# show the results.
self.next_url = self.request.URL
+ @property
+ def action_url(self):
+ """The forms should post to themselves, including GET params to
+ account for batch parameters.
+ """
+ return "%s?%s" % (self.request.getURL(), self.request['QUERY_STRING'])
+
def validate_sync(self, action, data):
"""Validate selected differences."""
form.getWidgetsData(self.widgets, self.prefix, data)
=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py 2011-06-27 16:42:35 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py 2011-06-27 16:46:21 +0000
@@ -28,7 +28,6 @@
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
-from canonical.config import config
from canonical.database.constants import UTC_NOW
from canonical.database.sqlbase import flush_database_caches
from canonical.launchpad.testing.pages import find_tag_by_id
@@ -51,6 +50,7 @@
RESOLVED,
seriesToVocab,
)
+from canonical.config import config
from lp.registry.enum import (
DistroSeriesDifferenceStatus,
DistroSeriesDifferenceType,
@@ -1737,15 +1737,16 @@
"updating and synchronizing…", view.describeJobs(dsd))
def _syncAndGetView(self, derived_series, person, sync_differences,
- difference_type=None, view_name='+localpackagediffs'):
+ difference_type=None, view_name='+localpackagediffs',
+ query_string=''):
# A helper to get the POST'ed sync view.
with person_logged_in(person):
view = create_initialized_view(
derived_series, view_name,
method='POST', form={
'field.selected_differences': sync_differences,
- 'field.actions.sync': 'Sync',
- })
+ 'field.actions.sync': 'Sync'},
+ query_string=query_string)
return view
def test_sync_error_nothing_selected(self):
@@ -1928,6 +1929,22 @@
derived_series.main_archive).one()
self.assertEqual(PackagePublishingPocket.UPDATES, pcj.target_pocket)
+ def test_diff_view_action_url(self):
+ # The difference pages have a fixed action_url so that the sync
+ # form self-posts.
+ derived_series, parent_series, unused, diff_id = self._setUpDSD(
+ 'my-src-name')
+ person = self.factory.makePerson()
+ set_derived_series_sync_feature_flag(self)
+ with person_logged_in(person):
+ view = create_initialized_view(
+ derived_series, '+localpackagediffs', method='GET',
+ query_string='start=1&batch=1')
+
+ self.assertEquals(
+ 'http://127.0.0.1?start=1&batch=1',
+ view.action_url)
+
class TestDistroSeriesNeedsPackagesView(TestCaseWithFactory):
"""Test the distroseries +needs-packaging view."""