mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 15:26:10 -04:00
Convert Transaction and Edu object to attrs (#10542)
Instead of wrapping the JSON into an object, this creates concrete instances for Transaction and Edu. This allows for improved type hints and simplified code.
This commit is contained in:
parent
60f0534b6e
commit
1de26b3467
8 changed files with 74 additions and 193 deletions
|
@ -45,7 +45,7 @@ class TransactionActions:
|
|||
`None` if we have not previously responded to this transaction or a
|
||||
2-tuple of `(int, dict)` representing the response code and response body.
|
||||
"""
|
||||
transaction_id = transaction.transaction_id # type: ignore
|
||||
transaction_id = transaction.transaction_id
|
||||
if not transaction_id:
|
||||
raise RuntimeError("Cannot persist a transaction with no transaction_id")
|
||||
|
||||
|
@ -56,7 +56,7 @@ class TransactionActions:
|
|||
self, origin: str, transaction: Transaction, code: int, response: JsonDict
|
||||
) -> None:
|
||||
"""Persist how we responded to a transaction."""
|
||||
transaction_id = transaction.transaction_id # type: ignore
|
||||
transaction_id = transaction.transaction_id
|
||||
if not transaction_id:
|
||||
raise RuntimeError("Cannot persist a transaction with no transaction_id")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue