Skip to content

Commit 3bca0f0

Browse files
committed
Enum type for EM models
Use correct `str` type for enum elements in EM models Signed-off-by: Anton Kremenetsky <anton.kremenetsky@gmail.com>
1 parent 8e5b2a6 commit 3bca0f0

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

genesis_core/elements/dm/models.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class Manifest(
6161
STATUS = AlwaysActiveStatus
6262

6363
status = properties.property(
64-
ra_types.Enum([s for s in Status]),
65-
default=STATUS.ACTIVE,
64+
ra_types.Enum([s.value for s in Status]),
65+
default=STATUS.ACTIVE.value,
6666
)
6767
version = properties.property(
6868
ra_types.String(min_length=5, max_length=64),
@@ -146,8 +146,8 @@ class Element(
146146
INSTALL_TYPES = InstallTypes
147147

148148
status = properties.property(
149-
ra_types.Enum([s for s in STATUSES]),
150-
default=STATUSES.NEW,
149+
ra_types.Enum([s.value for s in STATUSES]),
150+
default=STATUSES.NEW.value,
151151
)
152152

153153
version = properties.property(
@@ -156,8 +156,8 @@ class Element(
156156
)
157157

158158
install_type = properties.property(
159-
ra_types.Enum([s for s in INSTALL_TYPES]),
160-
default=INSTALL_TYPES.MANUAL,
159+
ra_types.Enum([s.value for s in INSTALL_TYPES]),
160+
default=INSTALL_TYPES.MANUAL.value,
161161
)
162162

163163
@property
@@ -210,11 +210,11 @@ class ElementIncorrectStatusesView(
210210
read_only=True,
211211
)
212212
api_status = properties.property(
213-
ra_types.Enum([s for s in Status]),
213+
ra_types.Enum([s.value for s in Status]),
214214
read_only=True,
215215
)
216216
actual_status = properties.property(
217-
ra_types.Enum([s for s in Status]),
217+
ra_types.Enum([s.value for s in Status]),
218218
read_only=True,
219219
)
220220

@@ -288,8 +288,8 @@ class Resource(
288288
read_only=True,
289289
)
290290
status = properties.property(
291-
ra_types.Enum(Status),
292-
default=Status.NEW,
291+
ra_types.Enum([s.value for s in Status]),
292+
default=Status.NEW.value,
293293
)
294294
resource_link_prefix = properties.property(
295295
ra_types.String(min_length=1, max_length=256),

0 commit comments

Comments
 (0)