Skip to content

Commit d064b0f

Browse files
committed
Server: Add method launch_at_stop()
1 parent bcf54d7 commit d064b0f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ikaaro/root.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@ def _get_names(self):
179179
return [ x for x in super(Root, self)._get_names() if x ]
180180

181181

182+
########################################################################
183+
# Start / Stop API
184+
########################################################################
185+
def launch_at_start(self, context):
186+
"""Method called at instance start"""
187+
pass
188+
189+
190+
def launch_at_stop(self, context):
191+
"""Method called at instance stop"""
192+
pass
193+
182194
########################################################################
183195
# API
184196
########################################################################
@@ -190,11 +202,6 @@ def get_default_edit_languages(self):
190202
return [self.get_default_language()]
191203

192204

193-
def launch_at_start(self, context):
194-
"""Method called at instance start"""
195-
pass
196-
197-
198205
def before_traverse(self, context, min=Decimal('0.000001'),
199206
zero=Decimal('0.0')):
200207
# Set the language cookie if specified by the query.

ikaaro/server.py

+3
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ def run(self):
293293

294294
def stop(self, signum, frame):
295295
print 'Shutting down the server...'
296+
context = get_context()
297+
if context and context.root:
298+
context.root.launch_at_stop(context)
296299
self.server.close()
297300
self.quit()
298301

0 commit comments

Comments
 (0)