~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Gavin Panella
  • Date: 2011-08-01 20:25:28 UTC
  • mto: This revision was merged to the branch mainline in revision 13585.
  • Revision ID: gavin.panella@canonical.com-20110801202528-jys4z4rsd44vs9kk
Don't modify the shared/'global' Action object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
828
828
        super(DistroSeriesDifferenceBaseView, self).initialize()
829
829
 
830
830
    def initialize_sync_label(self, label):
831
 
        # XXX: GavinPanella 2011-07-13 bug=809985: Good thing the app servers
832
 
        # are running single threaded...
833
 
        self.__class__.actions.byname['actions.sync'].label = label
 
831
        # Owing to the design of Action/Actions in zope.formlib.form - actions
 
832
        # is actually a descriptor that copies itself and its actions when
 
833
        # accessed - this has the effect of making a shallow copy of the sync
 
834
        # action which we can modify.
 
835
        actions = self.actions
 
836
        sync_action = next(
 
837
            action for action in actions if action.name == "sync")
 
838
        sync_action.label = label
 
839
        # Mask the actions descriptor with an instance variable.
 
840
        self.actions = actions.__class__(
 
841
            *((sync_action if action.name == "sync" else action)
 
842
              for action in actions))
834
843
 
835
844
    @property
836
845
    def label(self):