Skip to content

Commit

Permalink
Do not call init_app when an app or message_queue aren't given
Browse files Browse the repository at this point in the history
Fixes #367
  • Loading branch information
miguelgrinberg committed Nov 27, 2016
1 parent 2f7790c commit 37279e2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion flask_socketio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,16 @@ def __init__(self, app=None, **kwargs):
self.namespace_handlers = []
self.exception_handlers = {}
self.default_exception_handler = None
if app is not None or len(kwargs) > 0:
# We can call init_app when:
# - we were given the Flask app instance (standard initialization)
# - we were not given the app, but we were given a message_queue
# (standard initialization for auxiliary process)
# In all other cases we collect the arguments and assume the client
# will call init_app from an app factory function.
if app is not None or 'message_queue' in kwargs:
self.init_app(app, **kwargs)
else:
self.server_options.update(kwargs)

def init_app(self, app, **kwargs):
if app is not None:
Expand Down

0 comments on commit 37279e2

Please sign in to comment.