Docs/flake fixes

This commit is contained in:
Andrew Godwin 2016-05-25 17:52:53 -07:00
parent bfacee6319
commit 49c9b74d6f
5 changed files with 12 additions and 4 deletions

View File

@ -1 +1 @@
from .base import BaseConsumer
from .base import BaseConsumer # NOQA isort:skip

View File

@ -92,7 +92,7 @@ class WebsocketConsumer(BaseConsumer):
else:
raise ValueError("You must pass text or bytes")
def disconnect(self, message, **kwargs):
def raw_disconnect(self, message, **kwargs):
"""
Called when a WebSocket connection is closed. Base level so you don't
need to call super() all the time.

View File

@ -1,5 +1,6 @@
import types
def name_that_thing(thing):
"""
Returns either the function/class path or just the object's repr

View File

@ -10,7 +10,7 @@ We recommend you use them if you find them valuable; normal function-based
consumers are also entirely valid, however, and may result in more readable
code for simpler tasks.
There is one base class-based consumer class, ``BaseConsumer``, that provides
There is one base generic consumer class, ``BaseConsumer``, that provides
the pattern for method dispatch and is the thing you can build entirely
custom consumers on top of, and then protocol-specific subclasses that provide
extra utility - for example, the ``WebsocketConsumer`` provides automatic
@ -104,6 +104,8 @@ are used to add the socket to when it connects and to remove it from when it
disconnects; you get keyword arguments too if your URL path, say, affects
which group to talk to.
Additionally, the property ``self.path`` is always set to the current URL path.
The JSON-enabled consumer looks slightly different::
from channels.generic.websockets import JsonWebsocketConsumer
@ -140,7 +142,7 @@ The JSON-enabled consumer looks slightly different::
"""
pass
For this subclass, ``receive`` only gets a ``content`` parameter that is the
For this subclass, ``receive`` only gets a ``content`` argument that is the
already-decoded JSON as Python datastructures; similarly, ``send`` now only
takes a single argument, which it JSON-encodes before sending down to the
client.

View File

@ -74,3 +74,8 @@ strips off the ``/liveblog`` part it matches before passing it inside::
routing = [
include(inner_routes, path=r'^/liveblog')
]
You can also include named capture groups in the filters on an include and
they'll be passed to the consumer just like those on ``route``; note, though,
that if the keyword argument names from the ``include`` and the ``route``
clash, the values from ``route`` will take precedence.