From d064b0f1b4740a9488a5d204844c07848fa99a55 Mon Sep 17 00:00:00 2001 From: Taverne Sylvain Date: Tue, 9 May 2017 15:40:59 +0200 Subject: [PATCH] Server: Add method launch_at_stop() --- ikaaro/root.py | 17 ++++++++++++----- ikaaro/server.py | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ikaaro/root.py b/ikaaro/root.py index 081f3163f..5f288b705 100644 --- a/ikaaro/root.py +++ b/ikaaro/root.py @@ -179,6 +179,18 @@ def _get_names(self): return [ x for x in super(Root, self)._get_names() if x ] + ######################################################################## + # Start / Stop API + ######################################################################## + def launch_at_start(self, context): + """Method called at instance start""" + pass + + + def launch_at_stop(self, context): + """Method called at instance stop""" + pass + ######################################################################## # API ######################################################################## @@ -190,11 +202,6 @@ def get_default_edit_languages(self): return [self.get_default_language()] - def launch_at_start(self, context): - """Method called at instance start""" - pass - - def before_traverse(self, context, min=Decimal('0.000001'), zero=Decimal('0.0')): # Set the language cookie if specified by the query. diff --git a/ikaaro/server.py b/ikaaro/server.py index 805eae45b..1db3a8cd9 100644 --- a/ikaaro/server.py +++ b/ikaaro/server.py @@ -293,6 +293,9 @@ def run(self): def stop(self, signum, frame): print 'Shutting down the server...' + context = get_context() + if context and context.root: + context.root.launch_at_stop(context) self.server.close() self.quit()