/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/hooks.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-01 15:23:24 UTC
  • mto: This revision was merged to the branch mainline in revision 5751.
  • Revision ID: jelmer@samba.org-20110401152324-tfh1jv7r9x4nzn3h
Remove all callables with specified label, not just the first.

Show diffs side-by-side

added added

removed removed

Lines of Context:
351
351
 
352
352
        :param label: Label of the entry to uninstall
353
353
        """
 
354
        entries_to_remove = []
354
355
        for entry in self._callbacks:
355
356
            (entry_callback, entry_label) = entry
356
357
            if entry_label == label:
357
 
                self._callbacks.remove(entry)
358
 
                break
359
 
        else:
 
358
                entries_to_remove.append(entry)
 
359
        if entries_to_remove == []:
360
360
            raise KeyError("No entry with label %r" % label)
 
361
        for entry in entries_to_remove:
 
362
            self._callbacks.remove(entry)
361
363
 
362
364
    def __iter__(self):
363
365
        return (callback.get_obj() for callback, name in self._callbacks)