kopia lustrzana https://github.com/tsileo/little-boxes
Improve the parse_activity helper
rodzic
61eb998797
commit
26e65f976d
|
@ -122,6 +122,9 @@ COLLECTION_TYPES = [ActivityType.COLLECTION, ActivityType.ORDERED_COLLECTION]
|
||||||
def parse_activity(
|
def parse_activity(
|
||||||
payload: ObjectType, expected: Optional[ActivityType] = None
|
payload: ObjectType, expected: Optional[ActivityType] = None
|
||||||
) -> "BaseActivity":
|
) -> "BaseActivity":
|
||||||
|
if "type" not in payload:
|
||||||
|
raise BadActivityError(f"the payload has no type: {payload!r}")
|
||||||
|
|
||||||
t = ActivityType(_to_list(payload["type"])[0])
|
t = ActivityType(_to_list(payload["type"])[0])
|
||||||
|
|
||||||
if expected and t != expected:
|
if expected and t != expected:
|
||||||
|
|
Ładowanie…
Reference in New Issue