mirror of
https://github.com/minetest/contentdb.git
synced 2025-03-30 23:02:33 +02:00
Fix API crash due to missing upper() in enum coercion
This commit is contained in:
app/models
@ -72,7 +72,7 @@ class AuditSeverity(enum.Enum):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce(cls, item):
|
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):
|
class AuditLogEntry(db.Model):
|
||||||
|
@ -68,7 +68,7 @@ class PackageType(enum.Enum):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce(cls, item):
|
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):
|
class PackageState(enum.Enum):
|
||||||
@ -107,7 +107,7 @@ class PackageState(enum.Enum):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce(cls, item):
|
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 = {
|
PACKAGE_STATE_FLOW = {
|
||||||
@ -965,7 +965,7 @@ class PackageUpdateTrigger(enum.Enum):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce(cls, item):
|
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):
|
class PackageUpdateConfig(db.Model):
|
||||||
|
@ -54,7 +54,7 @@ class UserRank(enum.Enum):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce(cls, item):
|
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):
|
class Permission(enum.Enum):
|
||||||
@ -376,7 +376,7 @@ class NotificationType(enum.Enum):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce(cls, item):
|
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):
|
class Notification(db.Model):
|
||||||
|
Reference in New Issue
Block a user