mirror of
https://github.com/django/daphne.git
synced 2025-07-14 18:02:17 +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):
|
def __init__(self, routing=None):
|
||||||
self.consumers = {}
|
self.consumers = {}
|
||||||
# Add basic internal consumers
|
|
||||||
self.add_consumer(self.echo_consumer, ["__channels__.echo"])
|
|
||||||
# Initialise with any routing that was passed in
|
# Initialise with any routing that was passed in
|
||||||
if routing:
|
if routing:
|
||||||
# If the routing was a string, import it
|
# If the routing was a string, import it
|
||||||
|
@ -69,18 +67,10 @@ class ConsumerRegistry(object):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def echo_consumer(self, message):
|
def check_default(self, http_consumer=None):
|
||||||
"""
|
|
||||||
Implements the echo message standard.
|
|
||||||
"""
|
|
||||||
message.reply_channel.send({
|
|
||||||
"content": message.content.get("content", None),
|
|
||||||
})
|
|
||||||
|
|
||||||
def check_default(self):
|
|
||||||
"""
|
"""
|
||||||
Checks to see if default handlers need to be registered
|
Checks to see if default handlers need to be registered
|
||||||
for channels, and adds them if they need to be.
|
for channels, and adds them if they need to be.
|
||||||
"""
|
"""
|
||||||
if not self.consumer_for_channel("http.request"):
|
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