mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
Remove old echo code and allow configuring of http handler
This commit is contained in:
parent
d180f07b54
commit
e666355fad
|
@ -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"])
|
||||
|
|
Loading…
Reference in New Issue
Block a user