Skip to content

Commit d97bdb1

Browse files
author
Thomas Goodwin
committed
Modified enumeration to return a dict like properties do
1 parent 36fd97d commit d97bdb1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

model/domain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def __str__(self):
6565
# Helper class to convert the enumeration fields to something JSON serializable
6666
class EventHelper(object):
6767
ENUM_MAP = {
68-
'sourceCategory' : [str(i) for i in StandardEvent.SourceCategoryType._items],
69-
'stateChangeCategory' : [str(i) for i in StandardEvent.StateChangeCategoryType._items],
70-
'stateChangeFrom' : [str(i) for i in StandardEvent.StateChangeType._items],
71-
'stateChangeTo' : [str(i) for i in StandardEvent.StateChangeType._items],
68+
'sourceCategory' : dict([(str(val), idx) for idx, val in enumerate(StandardEvent.SourceCategoryType._items)]),
69+
'stateChangeCategory' : dict([(str(val), idx) for idx, val in enumerate(StandardEvent.StateChangeCategoryType._items)]),
70+
'stateChangeFrom' : dict([(str(val), idx) for idx, val in enumerate(StandardEvent.StateChangeType._items)]),
71+
'stateChangeTo' : dict([(str(val), idx) for idx, val in enumerate(StandardEvent.StateChangeType._items)]),
7272
}
7373

7474
@staticmethod

0 commit comments

Comments
 (0)