Skip to content

Commit

Permalink
Server: Add method launch_at_stop()
Browse files Browse the repository at this point in the history
  • Loading branch information
staverne committed May 9, 2017
1 parent bcf54d7 commit d064b0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ikaaro/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
########################################################################
Expand All @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions ikaaro/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit d064b0f

Please sign in to comment.