From 7111bb96ca8154e0e249ce29aa19527fcc92cf36 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 15 Feb 2016 13:24:01 -0600 Subject: [PATCH] Make datasync views easier to customize. Already needed to do that a little bit. --- tailbone/views/datasync.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tailbone/views/datasync.py b/tailbone/views/datasync.py index 876ac08d..3739483e 100644 --- a/tailbone/views/datasync.py +++ b/tailbone/views/datasync.py @@ -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)