- Hack webob.dec.wsgify for taking start_response function. - Add websocket handshake helper method to controller.
Signed-off-by: YAMADA Hideki <yamada.hid...@po.ntts.co.jp> --- ryu/app/wsgi.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py index 384c32c..320f6b7 100644 --- a/ryu/app/wsgi.py +++ b/ryu/app/wsgi.py @@ -67,6 +67,16 @@ class ControllerBase(object): return getattr(self, action)(req, **kwargs) + def websocket_handshake(self, req, handler): + ws_wsgi = hub.WebSocketWSGI(handler) + return ws_wsgi(req.environ, req.start_response) + + +class wsgify_hack(webob.dec.wsgify): + def __call__(self, environ, start_response): + self.kwargs['start_response'] = start_response + return super(wsgify_hack, self).__call__(environ, start_response) + class WSGIApplication(object): def __init__(self, **config): @@ -92,13 +102,14 @@ class WSGIApplication(object): match = self.mapper.match(req.path_info) return match - @webob.dec.wsgify - def __call__(self, req): + @wsgify_hack + def __call__(self, req, start_response): match = self._match(req) if not match: return webob.exc.HTTPNotFound() + req.start_response = start_response req.urlvars = match link = URLGenerator(self.mapper, req.environ) -- 1.7.9.5 ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel