Skip to content

Commit

Permalink
Makes sure ajax-updated rows still get correct actions allowed.
Browse files Browse the repository at this point in the history
Also moved some logic that pertained to BatchAction from
BaseAction to BatchAction where it belonged.

Fixes bug 944853.

Change-Id: I24f590f0b4320a0cc58d954398673a8fa75a49b6
  • Loading branch information
gabrielhurley committed Mar 7, 2012
1 parent 8ff0f46 commit 07adf63
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions horizon/tables/actions.py
Expand Up @@ -53,9 +53,6 @@ def allowed(self, request, datum):
return True

def _allowed(self, request, datum):
""" Default allowed checks for certain actions """
if isinstance(self, BatchAction) and not self.table.data:
return False
return self.allowed(request, datum)

def update(self, request, datum):
Expand Down Expand Up @@ -427,6 +424,13 @@ def __init__(self):
self._conjugate('plural'))
super(BatchAction, self).__init__()

def _allowed(self, request, datum=None):
# Override the default internal action method to prevent batch
# actions from appearing on tables with no data.
if not self.table.data and not datum:
return False
return super(BatchAction, self)._allowed(request, datum)

def _conjugate(self, items=None, past=False):
"""
Builds combinations like 'Delete Object' and 'Deleted
Expand Down

0 comments on commit 07adf63

Please sign in to comment.