Make datasync views easier to customize.

Already needed to do that a little bit.
This commit is contained in:
Lance Edgar 2016-02-15 13:24:01 -06:00
parent 715dce1655
commit 7111bb96ca

View file

@ -38,7 +38,7 @@ from tailbone.views import MasterView
log = logging.getLogger(__name__)
class DataSyncChangeView(MasterView):
class DataSyncChangesView(MasterView):
"""
Master view for the DataSyncChange model.
"""
@ -77,15 +77,20 @@ class DataSyncChangeView(MasterView):
self.request.session.flash("DataSync daemon could not be restarted; result was: {}".format(result), 'error')
return self.redirect(self.request.route_url('datasyncchanges'))
@classmethod
def defaults(cls, config):
# fix permission group title
config.add_tailbone_permission_group('datasync', label="DataSync")
# restart daemon
config.add_route('datasync.restart', '/datasync/restart')
config.add_view(cls, attr='restart', route_name='datasync.restart',
permission='datasync.restart')
config.add_tailbone_permission('datasync', 'datasync.restart', label="Restart DataSync Daemon")
cls._defaults(config)
def includeme(config):
config.add_tailbone_permission_group('datasync', label="DataSync")
# restart daemon
config.add_route('datasync.restart', '/datasync/restart')
config.add_view(DataSyncChangeView, attr='restart', route_name='datasync.restart',
permission='datasync.restart')
config.add_tailbone_permission('datasync', 'datasync.restart', label="Restart DataSync Daemon")
DataSyncChangeView.defaults(config)
DataSyncChangesView.defaults(config)