From 814aa64e776e69bb54c37347f859d1bb7d4579b1 Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 11:04:16 -0600 Subject: [PATCH 1/7] updated docs, updated gitignore --- .gitignore | 3 +++ docs/installation.rst | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index a49fd66..b8252fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *.egg-info dist/ docs/_build +__pycache__/ +*.swp + diff --git a/docs/installation.rst b/docs/installation.rst index 06a7c5c..2becc63 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -19,3 +19,16 @@ Once that's done, you should add ``channels`` to your That's it! Once enabled, ``channels`` will integrate itself into Django and take control of the ``runserver`` command. See :doc:`getting-started` for more. + + +Installing the lastest development version +------------------------------------------ + +To install the latest version of Channels, clone the repo, change to the repo, +change to the repo directory, and pip install it into your current virtual +environment:: + + $ git clone git@github.com:andrewgodwin/channels.git + $ cd channels + $ + (environment) $ pip install -e . # the dot specifies the current repo From 15d29a0230d31aa981a11c63bba6ca9414421009 Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 11:30:35 -0600 Subject: [PATCH 2/7] added external link to golang example --- docs/concepts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/concepts.rst b/docs/concepts.rst index e91cc64..1f2de1e 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -46,7 +46,7 @@ The channels have capacity, so a load of producers can write lots of messages into a channel with no consumers and then a consumer can come along later and will start getting served those queued messages. -If you've used channels in Go, these are reasonably similar to those. The key +If you've used `channels in Go `_, these are reasonably similar to those. The key difference is that these channels are network-transparent; the implementations of channels we provide are all accessible across a network to consumers and producers running in different processes or on different machines. From 19130ebb05a2eea7fe4b9af942826fe58463af5c Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 11:54:51 -0600 Subject: [PATCH 3/7] updated concepts and added six to reqs --- docs/concepts.rst | 2 +- setup.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/concepts.rst b/docs/concepts.rst index 1f2de1e..cb5febb 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -161,7 +161,7 @@ and be less than 200 characters long. It's optional for a backend implementation to understand this - after all, it's only important at scale, where you want to shard the two types differently -- but it's present nonetheless. For more on scaling, and how to handle channel +— but it's present nonetheless. For more on scaling, and how to handle channel types if you're writing a backend or interface server, read :doc:`scaling`. Groups diff --git a/setup.py b/setup.py index a5e0547..845e3c1 100644 --- a/setup.py +++ b/setup.py @@ -10,4 +10,7 @@ setup( license='BSD', packages=find_packages(), include_package_data=True, + install_requires=[ + 'six', + ] ) From bd6f61de98597463ab7b198cf3e07b4cb575a90b Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 12:00:47 -0600 Subject: [PATCH 4/7] updated getting started to include Group ref --- docs/getting-started.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 77ce6b0..6ed982e 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -123,6 +123,8 @@ And, even though channels will expire out, let's add an explicit ``disconnect`` handler to clean up as people disconnect (most channels will cleanly disconnect and get this called):: + from channels import Group + # Connected to websocket.disconnect def ws_disconnect(message): Group("chat").discard(message.reply_channel) From 275bfdf1e50954eef6d3349b1ecf6880c278d5b8 Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 12:04:01 -0600 Subject: [PATCH 5/7] Group ref on keepalive --- docs/getting-started.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 6ed982e..5d210d9 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -105,6 +105,8 @@ so we can hook that up to re-add the channel (it's safe to add the channel to a group it's already in - similarly, it's safe to discard a channel from a group it's not in):: + from channels import Group + # Connected to websocket.keepalive def ws_keepalive(message): Group("chat").add(message.reply_channel) From d4de42d3b26212f25209c302e0679df860292316 Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 12:04:52 -0600 Subject: [PATCH 6/7] Group ref on keepalive --- docs/getting-started.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 5d210d9..3d4c112 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -71,6 +71,8 @@ do any time. Let's try some WebSockets, and make a basic chat server! Delete that consumer and its routing - we'll want the normal Django view layer to serve HTTP requests from now on - and make this WebSocket consumer instead:: + from channels import Group + def ws_add(message): Group("chat").add(message.reply_channel) From 414a4ab460893d85f82371f3af62bbeb44578e28 Mon Sep 17 00:00:00 2001 From: Faris Chebib Date: Thu, 10 Sep 2015 12:26:08 -0600 Subject: [PATCH 7/7] updated print statements --- channels/worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels/worker.py b/channels/worker.py index 50de9bd..b54dc44 100644 --- a/channels/worker.py +++ b/channels/worker.py @@ -35,5 +35,5 @@ class Worker(object): except Message.Requeue: self.channel_backend.send(channel, content) except: - print "Error processing message with consumer %s:" % name_that_thing(consumer) + print("Error processing message with consumer {}:".format(name_that_thing(consumer))) traceback.print_exc()