fix: Remove enum contains for 3.11 compat.
This commit is contained in:
@@ -72,7 +72,7 @@ class Event:
|
|||||||
conds.append(EventD.occurred_at >= after)
|
conds.append(EventD.occurred_at >= after)
|
||||||
if event_type is not None:
|
if event_type is not None:
|
||||||
ekey = (event_type.lower().strip(),)
|
ekey = (event_type.lower().strip(),)
|
||||||
if ekey not in EventType:
|
if ekey not in [e.value for e in EventType]:
|
||||||
raise web.HTTPBadRequest(text=f"Unknown event type '{event_type}'")
|
raise web.HTTPBadRequest(text=f"Unknown event type '{event_type}'")
|
||||||
conds.append(EventD.event_type == EventType(ekey))
|
conds.append(EventD.event_type == EventType(ekey))
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ class Event:
|
|||||||
raise web.HTTPBadRequest(text="Event creation missing required field 'event_type'.")
|
raise web.HTTPBadRequest(text="Event creation missing required field 'event_type'.")
|
||||||
|
|
||||||
ekey = (params['event_type'].lower().strip(),)
|
ekey = (params['event_type'].lower().strip(),)
|
||||||
if ekey not in EventType:
|
if ekey not in [e.value for e in EventType]:
|
||||||
raise web.HTTPBadRequest(text=f"Unknown event type '{params['event_type']}'")
|
raise web.HTTPBadRequest(text=f"Unknown event type '{params['event_type']}'")
|
||||||
event_type = EventType(ekey)
|
event_type = EventType(ekey)
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ class Event:
|
|||||||
# EventD = data.EventDetails
|
# EventD = data.EventDetails
|
||||||
|
|
||||||
ekey = (kwargs['event_type'].lower().strip(),)
|
ekey = (kwargs['event_type'].lower().strip(),)
|
||||||
if ekey not in EventType:
|
if ekey not in [e.value for e in EventType]:
|
||||||
raise web.HTTPBadRequest(text=f"Unknown event type '{kwargs['event_type']}'")
|
raise web.HTTPBadRequest(text=f"Unknown event type '{kwargs['event_type']}'")
|
||||||
event_type = EventType(ekey)
|
event_type = EventType(ekey)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user