kopia lustrzana https://gitlab.com/jaywink/federation
'skip_author_verification' to controllers.handle_receive too
rodzic
a568bd6a9e
commit
908e90bcaa
|
|
@ -8,13 +8,14 @@ PROTOCOLS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_receive(payload, user=None, sender_key_fetcher=None):
|
def handle_receive(payload, user=None, sender_key_fetcher=None, skip_author_verification=False):
|
||||||
"""Takes a payload and passes it to the correct protocol.
|
"""Takes a payload and passes it to the correct protocol.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
payload (str) - Payload blob
|
payload (str) - Payload blob
|
||||||
user (optional, obj) - User that will be passed to `protocol.receive`
|
user (optional, obj) - User that will be passed to `protocol.receive`
|
||||||
sender_key_fetcher (optional, func) - Function that accepts sender handle and returns public key
|
sender_key_fetcher (optional, func) - Function that accepts sender handle and returns public key
|
||||||
|
skip_author_verification (optional, bool) - Don't verify sender (test purposes, false default)
|
||||||
"""
|
"""
|
||||||
found_protocol = None
|
found_protocol = None
|
||||||
for protocol_name in PROTOCOLS:
|
for protocol_name in PROTOCOLS:
|
||||||
|
|
@ -25,7 +26,8 @@ def handle_receive(payload, user=None, sender_key_fetcher=None):
|
||||||
|
|
||||||
if found_protocol:
|
if found_protocol:
|
||||||
protocol = found_protocol.Protocol()
|
protocol = found_protocol.Protocol()
|
||||||
sender, message = protocol.receive(payload, user, sender_key_fetcher)
|
sender, message = protocol.receive(
|
||||||
|
payload, user, sender_key_fetcher, skip_author_verification=skip_author_verification)
|
||||||
else:
|
else:
|
||||||
raise NoSuitableProtocolFoundError()
|
raise NoSuitableProtocolFoundError()
|
||||||
|
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue