changeset 2771:9640c1c6399b beta

really check if last status is from pull request
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 01 Sep 2012 21:56:56 +0200
parents 74364824c1e1
children d4f6dc38d625
files rhodecode/model/changeset_status.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/changeset_status.py	Sat Sep 01 21:33:31 2012 +0200
+++ b/rhodecode/model/changeset_status.py	Sat Sep 01 21:56:56 2012 +0200
@@ -146,8 +146,9 @@
 
         #if statuses exists and last is associated with a closed pull request
         # we need to check if we can allow this status change
-        if (dont_allow_on_closed_pull_request and cur_statuses 
-            and cur_statuses[0].pull_request.status == PullRequest.STATUS_CLOSED):
+        if (dont_allow_on_closed_pull_request and cur_statuses
+            and getattr(cur_statuses[0].pull_request, 'status', '')
+                == PullRequest.STATUS_CLOSED):
             raise StatusChangeOnClosedPullRequestError(
                 'Changing status on closed pull request is not allowed'
             )