diff options
author | 2018-02-18 11:21:57 +0000 | |
---|---|---|
committer | 2018-02-18 11:21:57 +0000 | |
commit | 218db5222983b2b102b5f32a77845468cdaf9dab (patch) | |
tree | b9eb2601f90ddcb9c1226f0aa8493aa34c7111be | |
parent | Go back to using wss:// for the WS test (diff) |
Rename "Websocket" to "WS" to avoid confusion with the gevents-websocket WebSocket class
Diffstat (limited to '')
-rw-r--r-- | pysite/mixins.py | 2 | ||||
-rw-r--r-- | pysite/route_manager.py | 8 | ||||
-rw-r--r-- | pysite/views/ws/echo.py | 4 | ||||
-rw-r--r-- | pysite/websockets.py | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/pysite/mixins.py b/pysite/mixins.py index 891aa185..49e6c25b 100644 --- a/pysite/mixins.py +++ b/pysite/mixins.py @@ -23,7 +23,7 @@ class DBMixin: This class will also work with Websockets: - >>> class MyWeboscket(Websocket, DBMixin): + >>> class MyWeboscket(WS, DBMixin): ... name = "my_websocket" ... path = "/my_websocket" ... table_name = "my_table" diff --git a/pysite/route_manager.py b/pysite/route_manager.py index b3f71643..739af726 100644 --- a/pysite/route_manager.py +++ b/pysite/route_manager.py @@ -9,7 +9,7 @@ from flask_sockets import Sockets from pysite.base_route import APIView, BaseView, ErrorView, RouteView from pysite.database import RethinkDB -from pysite.websockets import Websocket +from pysite.websockets import WS TEMPLATES_PATH = "../templates" STATIC_PATH = "../static" @@ -82,10 +82,10 @@ class RouteManager: cls is not ErrorView and cls is not RouteView and cls is not APIView and - cls is not Websocket and + cls is not WS and ( - BaseView in cls.__mro__ or - Websocket in cls.__mro__ + BaseView in cls.__mro__ or + WS in cls.__mro__ ) ): cls.setup(self, blueprint) diff --git a/pysite/views/ws/echo.py b/pysite/views/ws/echo.py index 135adfcf..06dffdc4 100644 --- a/pysite/views/ws/echo.py +++ b/pysite/views/ws/echo.py @@ -1,8 +1,8 @@ # coding=utf-8 -from pysite.websockets import Websocket +from pysite.websockets import WS -class EchoWebsocket(Websocket): +class EchoWebsocket(WS): path = "/echo" name = "ws_echo" diff --git a/pysite/websockets.py b/pysite/websockets.py index f82217ef..fa1fd0eb 100644 --- a/pysite/websockets.py +++ b/pysite/websockets.py @@ -4,7 +4,7 @@ from flask import Blueprint from geventwebsocket.websocket import WebSocket -class Websocket: +class WS: """ Base class for representing a Websocket. @@ -13,7 +13,7 @@ class Websocket: If you need access to the database, you can mix-in DBMixin, just like any view class: - >>> class DBWebsocket(Websocket, DBMixin): + >>> class DBWebsocket(WS, DBMixin): ... name = "db_websocket" ... path = "/db_websocket" # This will be prefixed with "/ws" by the blueprint ... table = "ws" @@ -61,7 +61,7 @@ class Websocket: self.socket.send(message, binary=binary) @classmethod - def setup(cls: "type(Websocket)", manager: "pysite.route_manager.RouteManager", blueprint: Blueprint): + def setup(cls: "type(WS)", manager: "pysite.route_manager.RouteManager", blueprint: Blueprint): """ Set up the websocket object, calling `setup()` on any superclasses as necessary (for example, on the DB mixin). @@ -78,7 +78,7 @@ class Websocket: def handle(socket: WebSocket): """ - Wrap the current Websocket class, dispatching events to it as necessary. We're using gevent, so there's + Wrap the current WS class, dispatching events to it as necessary. We're using gevent, so there's no need to worry about blocking here. """ |