Add websockets progress, "multi-system" support for upgrades
and related things to better support that
This commit is contained in:
parent
db3f215ebe
commit
18cec49a86
12 changed files with 731 additions and 114 deletions
|
@ -195,22 +195,20 @@ def add_websocket(config, name, view, attr=None):
|
|||
view_callable = rattail_app.load_object(view)
|
||||
else:
|
||||
view_callable = view
|
||||
view_callable = view_callable(config.registry)
|
||||
view_callable = view_callable(config)
|
||||
if attr:
|
||||
view_callable = getattr(view_callable, attr)
|
||||
|
||||
path = '/ws/{}'.format(name)
|
||||
|
||||
# register route
|
||||
config.add_route('ws.{}'.format(name),
|
||||
path,
|
||||
static=True)
|
||||
path = '/ws/{}'.format(name)
|
||||
route_name = 'ws.{}'.format(name)
|
||||
config.add_route(route_name, path, static=True)
|
||||
|
||||
# register view callable
|
||||
websockets = config.registry.setdefault('tailbone_websockets', {})
|
||||
websockets[path] = view_callable
|
||||
|
||||
config.action('tailbone-add-websocket', action,
|
||||
config.action('tailbone-add-websocket-{}'.format(name), action,
|
||||
# nb. since this action adds routes, it must happen
|
||||
# sooner in the order than it normally would, hence
|
||||
# we declare that
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue