bodhi/templates/show.kid | 85 +++++++++++++++++++++------------------- bodhi/tests/test_controllers.py | 4 + 2 files changed, 50 insertions(+), 39 deletions(-)
New commits: commit 1a750a4cc4896b8838d93eaed10f963b675a0955 Author: Luke Macken lmacken@redhat.com Date: Thu Mar 4 16:04:15 2010 -0500
Refactor the "Push to stable" logic in our show.kid, hopefully multiple issues.
This also modifies a unit test to ensure we can push non-critpath updates to stable right after they're submitted. This should also fix the duplicate 'Mark as Stable' button issue.
diff --git a/bodhi/templates/show.kid b/bodhi/templates/show.kid index 04950a8..2ae0995 100644 --- a/bodhi/templates/show.kid +++ b/bodhi/templates/show.kid @@ -75,32 +75,37 @@ karma = "<img src="%s" align="top" /> <b>%d</b>" % (tg.url('/static/images/k </a> </td> </span> - <span py:if="update.release.locked and update.critpath and update.critpath_approved"> - <span py:if="'qa' in tg.identity.groups or 'releng' in tg.identity.groups"> + + <span py:if="update.status != 'stable'"> + <span py:if="update.release.locked"> + <span py:if="update.critpath"> + <span py:if="update.critpath_approved"> + <td> + <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> + <img src="${tg.url('/static/images/submit.png')}" border="0"/> + Push Critical Path update to Stable + </a> + </td> + </span> + </span> + <span py:if="not update.critpath"> + <td> + <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> + <img src="${tg.url('/static/images/submit.png')}" border="0"/> + Push to Stable + </a> + </td> + </span> + </span> + <span py:if="not update.release.locked"> <td> <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> <img src="${tg.url('/static/images/submit.png')}" border="0"/> - Push Critical Path update to Stable + Push to Stable </a> </td> </span> </span> - <span py:if="update.status != 'stable' and update.release.locked and not update.critpath and update.critpath_approved"> - <td> - <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> - <img src="${tg.url('/static/images/submit.png')}" border="0"/> - Push to Stable - </a> - </td> - </span> - <span py:if="not update.release.locked and update.status != 'stable'"> - <td> - <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> - <img src="${tg.url('/static/images/submit.png')}" border="0"/> - Push to Stable - </a> - </td> - </span> <td> <a href="${util.url('/confirm_delete?nvr=%s' % update.title)}" class="list"> <img src="${tg.url('/static/images/trash.png')}" border="0"/> @@ -124,40 +129,42 @@ karma = "<img src="%s" align="top" /> <b>%d</b>" % (tg.url('/static/images/k </td> <span py:if="update.status == 'testing'"> <span py:if="update.request == None"> - <span py:if="update.release.locked and update.critpath and update.critpath_approved"> - <span py:if="'qa' in tg.identity.groups or 'releng' in tg.identity.groups"> - <td> - <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> - <img src="${tg.url('/static/images/submit.png')}" border="0"/> - Mark Critical Path update as Stable - </a> - </td> - </span> - </span> - <span py:if="not update.critpath"> + <span py:if="update.release.locked"> + <span py:if="update.critpath"> + <span py:if="update.critpath_approved"> + <td> + <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> + <img src="${tg.url('/static/images/submit.png')}" border="0"/> + Mark Critical Path update as Stable + </a> + </td> + </span> + </span> + <span py:if="not update.critpath"> + <td> + <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> + <img src="${tg.url('/static/images/submit.png')}" border="0"/> + Mark as Stable + </a> + </td> + </span> + </span> + <span py:if="not update.release.locked"> <td> <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> <img src="${tg.url('/static/images/submit.png')}" border="0"/> Mark as Stable </a> </td> + </span> </span> </span> - <span py:if="not update.release.locked"> - <td> - <a href="${util.url('/request/stable/%s' % update.title)}" class="list"> - <img src="${tg.url('/static/images/submit.png')}" border="0"/> - Mark as Stable - </a> - </td> - </span> <td> <a href="${util.url('/edit/%s' % update.title)}" class="list"> <img src="${tg.url('/static/images/edit.png')}" border="0"/> Edit </a> </td> - </span> </span> <span py:if="update.pushed and update.status == 'stable' and 'releng' in tg.identity.groups"> <td> diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py index eeedc03..adf32d3 100644 --- a/bodhi/tests/test_controllers.py +++ b/bodhi/tests/test_controllers.py @@ -1628,6 +1628,10 @@ class TestControllers(testutil.DBTest): self.save_update(params, session) update = PackageUpdate.byTitle(params['builds'])
+ testutil.create_request('/updates/%s' % params['builds'], + method='GET', headers=session) + + assert "/updates/request/stable" in cherrypy.response.body[0], cherrypy.response.body[0] # Pretend it's pushed to testing update.pushed = True update.status = 'testing'