[gen] Added the possibility to display the content of indexes for a given object on its view layout (param 'indexed' in the request).

This commit is contained in:
Gaetan Delannay 2014-12-19 11:21:43 +01:00
parent 982ae08997
commit 06c656d278
8 changed files with 66 additions and 8 deletions

View file

@ -1730,4 +1730,18 @@ class BaseMixin:
method = self.REQUEST['method']
obj = self.appy()
return getattr(obj, method)()
def onReindex(self):
'''Called for reindexing an index or all indexes on the currently shown
object.'''
if not self.getTool().getUser().has_role('Manager'):
self.raiseUnauthorized()
rq = self.REQUEST
indexName = rq['indexName']
if indexName == '_all_':
self.reindex()
else:
self.reindex(indexes=(indexName,))
self.say(self.translate('action_done'))
self.goto(self.getUrl(rq['HTTP_REFERER']))
# ------------------------------------------------------------------------------