mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Fix API crash due to missing upper() in enum coercion
This commit is contained in:
parent
aead579f0b
commit
04e108c31e
@ -72,7 +72,7 @@ class AuditSeverity(enum.Enum):
|
||||
|
||||
@classmethod
|
||||
def coerce(cls, item):
|
||||
return item if type(item) == AuditSeverity else AuditSeverity[item]
|
||||
return item if type(item) == AuditSeverity else AuditSeverity[item.upper()]
|
||||
|
||||
|
||||
class AuditLogEntry(db.Model):
|
||||
|
@ -68,7 +68,7 @@ class PackageType(enum.Enum):
|
||||
|
||||
@classmethod
|
||||
def coerce(cls, item):
|
||||
return item if type(item) == PackageType else PackageType[item]
|
||||
return item if type(item) == PackageType else PackageType[item.upper()]
|
||||
|
||||
|
||||
class PackageState(enum.Enum):
|
||||
@ -107,7 +107,7 @@ class PackageState(enum.Enum):
|
||||
|
||||
@classmethod
|
||||
def coerce(cls, item):
|
||||
return item if type(item) == PackageState else PackageState[item]
|
||||
return item if type(item) == PackageState else PackageState[item.upper()]
|
||||
|
||||
|
||||
PACKAGE_STATE_FLOW = {
|
||||
@ -965,7 +965,7 @@ class PackageUpdateTrigger(enum.Enum):
|
||||
|
||||
@classmethod
|
||||
def coerce(cls, item):
|
||||
return item if type(item) == PackageUpdateTrigger else PackageUpdateTrigger[item]
|
||||
return item if type(item) == PackageUpdateTrigger else PackageUpdateTrigger[item.upper()]
|
||||
|
||||
|
||||
class PackageUpdateConfig(db.Model):
|
||||
|
@ -54,7 +54,7 @@ class UserRank(enum.Enum):
|
||||
|
||||
@classmethod
|
||||
def coerce(cls, item):
|
||||
return item if type(item) == UserRank else UserRank[item]
|
||||
return item if type(item) == UserRank else UserRank[item.upper()]
|
||||
|
||||
|
||||
class Permission(enum.Enum):
|
||||
@ -376,7 +376,7 @@ class NotificationType(enum.Enum):
|
||||
|
||||
@classmethod
|
||||
def coerce(cls, item):
|
||||
return item if type(item) == NotificationType else NotificationType[item]
|
||||
return item if type(item) == NotificationType else NotificationType[item.upper()]
|
||||
|
||||
|
||||
class Notification(db.Model):
|
||||
|
Loading…
Reference in New Issue
Block a user