launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15740
[Merge] lp:~stevenk/launchpad/transition-from-done-is-bad into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/transition-from-done-is-bad into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/transition-from-done-is-bad/+merge/176691
Become more draconian about changing statuses of PackageUpload -- this allows us to actually raise errors if you attempt to accept a package upload that is DONE, for example.
--
https://code.launchpad.net/~stevenk/launchpad/transition-from-done-is-bad/+merge/176691
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/transition-from-done-is-bad into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2013-07-16 08:10:32 +0000
+++ lib/lp/soyuz/model/queue.py 2013-07-24 13:57:32 +0000
@@ -326,14 +326,16 @@
def setNew(self):
"""See `IPackageUpload`."""
- if self.status == PackageUploadStatus.NEW:
- raise QueueInconsistentStateError('Queue item already new')
+ if self.status != PackageUploadStatus.NEW:
+ raise QueueInconsistentStateError(
+ 'Can not set modified queue items to NEW.')
self.status = PassthroughStatusValue(PackageUploadStatus.NEW)
def setUnapproved(self):
"""See `IPackageUpload`."""
- if self.status == PackageUploadStatus.UNAPPROVED:
- raise QueueInconsistentStateError('Queue item already unapproved')
+ if self.status != PackageUploadStatus.NEW:
+ raise QueueInconsistentStateError(
+ 'Can not set modified queue items to UNAPPROVED.')
self.status = PassthroughStatusValue(PackageUploadStatus.UNAPPROVED)
def setAccepted(self):
@@ -345,8 +347,11 @@
"series in the '%s' state." % (
self.pocket.name, self.distroseries.status.name))
- if self.status == PackageUploadStatus.ACCEPTED:
- raise QueueInconsistentStateError('Queue item already accepted')
+ if self.status not in (
+ PackageUploadStatus.NEW, PackageUploadStatus.UNAPPROVED,
+ PackageUploadStatus.REJECTED):
+ raise QueueInconsistentStateError(
+ 'Unable to accept queue item due to status.')
for source in self.sources:
source.verifyBeforeAccept()
@@ -437,8 +442,11 @@
def setRejected(self):
"""See `IPackageUpload`."""
- if self.status == PackageUploadStatus.REJECTED:
- raise QueueInconsistentStateError('Queue item already rejected')
+ if self.status not in (
+ PackageUploadStatus.NEW, PackageUploadStatus.UNAPPROVED,
+ PackageUploadStatus.ACCEPTED):
+ raise QueueInconsistentStateError(
+ 'Unable to reject queue item due to status.')
self.status = PassthroughStatusValue(PackageUploadStatus.REJECTED)
def _closeBugs(self, changesfile_path, logger=None):