summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/views.py
diff options
context:
space:
mode:
authorMagnus Hagander2014-05-18 16:32:54 +0000
committerMagnus Hagander2014-05-18 16:32:54 +0000
commitd8e5e8a2b66eba4a11b19a12bce6690b4dbd2cc2 (patch)
treec3db71757a18ab43a5d287a4381b95866f2f45c5 /pgcommitfest/commitfest/views.py
parent4e8866f00666d8c9c4781cf2b73685f95fc8328e (diff)
Give better error msg when trying to close out a patch on the last available cf
Diffstat (limited to 'pgcommitfest/commitfest/views.py')
-rw-r--r--pgcommitfest/commitfest/views.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index f34fd54..c6a69c1 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -353,9 +353,18 @@ def close(request, cfid, patchid, status):
if len(newcf) == 0:
raise Exception("No open and no future commitfest exists!")
elif len(newcf) != 1:
- raise Exception("No open and multiple future commitfests exists!")
+ raise Exception("No open and multiple future commitfests exist!")
elif len(newcf) != 1:
raise Exception("Multiple open commitfests exists!")
+ elif newcf[0] == poc.commitfest:
+ # The current open CF is the same one that we are already on.
+ # In this case, try to see if there is a future CF we can
+ # move it to.
+ newcf = CommitFest.objects.filter(status=CommitFest.STATUS_FUTURE)
+ if len(newcf) == 0:
+ raise Exception("Cannot move patch to the same commitfest, and no future commitfests exist!")
+ elif len(newcf) != 1:
+ raise Exception("Cannot move patch to the same commitfest, and multiple future commitfests exist!")
# Create a mapping to the new commitfest that we are bouncing
# this patch to.
newpoc = PatchOnCommitFest(patch=poc.patch, commitfest=newcf[0], enterdate=datetime.now())