From e666355fad91783597464be822259ee9328e61e7 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 20 Feb 2016 23:31:27 +0000 Subject: [PATCH] Remove old echo code and allow configuring of http handler --- channels/consumer_registry.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/channels/consumer_registry.py b/channels/consumer_registry.py index 69743e0..7cd7a57 100644 --- a/channels/consumer_registry.py +++ b/channels/consumer_registry.py @@ -19,8 +19,6 @@ class ConsumerRegistry(object): def __init__(self, routing=None): self.consumers = {} - # Add basic internal consumers - self.add_consumer(self.echo_consumer, ["__channels__.echo"]) # Initialise with any routing that was passed in if routing: # If the routing was a string, import it @@ -69,18 +67,10 @@ class ConsumerRegistry(object): except KeyError: return None - def echo_consumer(self, message): - """ - Implements the echo message standard. - """ - message.reply_channel.send({ - "content": message.content.get("content", None), - }) - - def check_default(self): + def check_default(self, http_consumer=None): """ Checks to see if default handlers need to be registered for channels, and adds them if they need to be. """ if not self.consumer_for_channel("http.request"): - self.add_consumer(ViewConsumer(), ["http.request"]) + self.add_consumer(http_consumer or ViewConsumer(), ["http.request"])