~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/distroseries.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-19 19:56:38 UTC
  • mfrom: (14487.5.12 sync-sponsored-widget)
  • Revision ID: launchpad@pqm.canonical.com-20111219195638-h3w3tzvxbpv83i3p
[r=allenap][bug=827555] Add a person picker on the package sync pages
        so that the user can specify a user to sponsor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    LaunchpadDropdownWidget,
78
78
    LaunchpadRadioWidget,
79
79
    )
 
80
from lp.app.widgets.popup import PersonPickerWidget
80
81
from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
81
82
from lp.blueprints.browser.specificationtarget import (
82
83
    HasSpecificationsMenuMixin,
881
882
        description=_("Select the differences for syncing."),
882
883
        required=True)
883
884
 
 
885
    sponsored_person = Choice(
 
886
        title=u"Person being sponsored", vocabulary='ValidPerson',
 
887
        required=False)
 
888
 
884
889
 
885
890
class DistroSeriesDifferenceBaseView(LaunchpadFormView,
886
891
                                     PackageCopyingMixin,
888
893
    """Base class for all pages presenting differences between
889
894
    a derived series and its parent."""
890
895
    schema = IDifferencesFormSchema
891
 
    field_names = ['selected_differences']
 
896
    field_names = ['selected_differences', 'sponsored_person']
892
897
    custom_widget('selected_differences', LabeledMultiCheckBoxWidget)
893
898
    custom_widget('package_type', LaunchpadRadioWidget)
 
899
    custom_widget(
 
900
        'sponsored_person', PersonPickerWidget,
 
901
        header="Select person being sponsored", show_assign_me_button=False)
894
902
 
895
903
    # Differences type to display. Can be overrided by sublasses.
896
904
    differences_type = DistroSeriesDifferenceType.DIFFERENT_VERSIONS
909
917
        if not getFeatureFlag('soyuz.derived_series_ui.enabled'):
910
918
            self.request.response.redirect(canonical_url(self.context))
911
919
            return
912
 
 
913
920
        super(DistroSeriesDifferenceBaseView, self).initialize()
914
921
 
915
922
    def initialize_sync_label(self, label):
977
984
        else:
978
985
            destination_pocket = PackagePublishingPocket.RELEASE
979
986
 
 
987
        sponsored_person = data.get("sponsored_person")
 
988
 
980
989
        # When syncing we *must* do it asynchronously so that a package
981
990
        # copy job is created.  This gives the job a chance to inspect
982
991
        # the copy and create a PackageUpload if required.
984
993
            'selected_differences', sources, self.context.main_archive,
985
994
            self.context, destination_pocket, include_binaries=False,
986
995
            dest_url=series_url, dest_display_name=series_title,
987
 
            person=self.user, force_async=True):
 
996
            person=self.user, force_async=True,
 
997
            sponsored_person=sponsored_person):
988
998
            # The copy worked so we redirect back to show the results. Include
989
999
            # the query string so that the user ends up on the same batch page
990
1000
            # with the same filtering parameters as before.