mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-11-12 02:36:35 -05:00
PEP8
This commit is contained in:
parent
c46088405a
commit
5d439b127b
8 changed files with 22 additions and 20 deletions
|
|
@ -549,7 +549,6 @@ class ReplicationLayer(object):
|
|||
origin, pdu.room_id, pdu.event_id,
|
||||
)
|
||||
|
||||
|
||||
if not backfilled:
|
||||
ret = yield self.handler.on_receive_pdu(
|
||||
pdu,
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ class TransportLayer(object):
|
|||
origin = None
|
||||
|
||||
if request.method == "PUT":
|
||||
#TODO: Handle other method types? other content types?
|
||||
# TODO: Handle other method types? other content types?
|
||||
try:
|
||||
content_bytes = request.content.read()
|
||||
content = json.loads(content_bytes)
|
||||
|
|
@ -296,11 +296,13 @@ class TransportLayer(object):
|
|||
try:
|
||||
params = auth.split(" ")[1].split(",")
|
||||
param_dict = dict(kv.split("=") for kv in params)
|
||||
|
||||
def strip_quotes(value):
|
||||
if value.startswith("\""):
|
||||
return value[1:-1]
|
||||
else:
|
||||
return value
|
||||
|
||||
origin = strip_quotes(param_dict["origin"])
|
||||
key = strip_quotes(param_dict["key"])
|
||||
sig = strip_quotes(param_dict["sig"])
|
||||
|
|
@ -321,7 +323,7 @@ class TransportLayer(object):
|
|||
if auth.startswith("X-Matrix"):
|
||||
(origin, key, sig) = parse_auth_header(auth)
|
||||
json_request["origin"] = origin
|
||||
json_request["signatures"].setdefault(origin,{})[key] = sig
|
||||
json_request["signatures"].setdefault(origin, {})[key] = sig
|
||||
|
||||
if not json_request["signatures"]:
|
||||
raise SynapseError(
|
||||
|
|
@ -515,7 +517,8 @@ class TransportLayer(object):
|
|||
return
|
||||
|
||||
try:
|
||||
code, response = yield self.received_handler.on_incoming_transaction(
|
||||
handler = self.received_handler
|
||||
code, response = yield handler.on_incoming_transaction(
|
||||
transaction_data
|
||||
)
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -192,7 +192,9 @@ class Transaction(JsonEncodedObject):
|
|||
transaction_id and origin_server_ts keys.
|
||||
"""
|
||||
if "origin_server_ts" not in kwargs:
|
||||
raise KeyError("Require 'origin_server_ts' to construct a Transaction")
|
||||
raise KeyError(
|
||||
"Require 'origin_server_ts' to construct a Transaction"
|
||||
)
|
||||
if "transaction_id" not in kwargs:
|
||||
raise KeyError(
|
||||
"Require 'transaction_id' to construct a Transaction"
|
||||
|
|
@ -204,6 +206,3 @@ class Transaction(JsonEncodedObject):
|
|||
kwargs["pdus"] = [p.get_dict() for p in pdus]
|
||||
|
||||
return Transaction(**kwargs)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue