diff --git a/.gitignore b/.gitignore index 5813b6e..d6482b4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ coverage.xml __pycache__ tests/__pycache__ - +*.pyc build responder.egg-info/ dist/ diff --git a/docs/source/tour.rst b/docs/source/tour.rst index 089908a..b7462bb 100644 --- a/docs/source/tour.rst +++ b/docs/source/tour.rst @@ -185,7 +185,7 @@ WebSocket Support Responder supports WebSockets:: - @api.ws_route('/ws') + @api.route('/ws', websocket=True) async def hello(ws): await ws.accept() await ws.send_text("Hello via websocket!") diff --git a/responder/routes.py b/responder/routes.py index 1183a99..fa00975 100644 --- a/responder/routes.py +++ b/responder/routes.py @@ -77,8 +77,9 @@ class Route: def is_class_based(self): return hasattr(self.endpoint, "__class__") + @property def is_function(self): - routed = hasattr(self.endpoint, "is_routed") + is_callable = callable(self.endpoint) code = hasattr(self.endpoint, "__code__") kwdefaults = hasattr(self.endpoint, "__kwdefaults__") - return all((routed, code, kwdefaults)) + return all((is_callable, code, kwdefaults)) diff --git a/setup.py b/setup.py index e92701b..49a8d54 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ required = [ "python-multipart", "chardet", "apispec>=1.0.0b1", - "marshmallow", + "marshmallow>=3.0.0b7", "asgiref", "docopt", "itsdangerous",