diff rhodecode/model/changeset_status.py @ 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 4fbbc65e8cd5
children 0b2214604c74
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'
             )