Datastore Enum Types No Longer Serialized

36 views
Skip to first unread message

Larry Schiefer

unread,
Oct 9, 2020, 7:13:54 AM10/9/20
to Google App Engine
We are using GAE python standard environment (Python 2.7) and suddenly our app started experiencing issues when serializing a datastore enum property. Our code has been deployed and working for over 6 months and today it is failing. For example:

class SomeType(messages.Enum):
    FIRST_TYPE = 1
    SECOND_TYPE = 2
    THIRD_TYPE = 3

class SomeEntity(polymodel.PolyModel):
    # Other fields not shown
    something = msgprop.EnumProperty(SomeType, repeated=true)

    def get_msg_data(self):
        msg_data = {
            'something': json.dumps(self.something)
        }
        return msg_data

The call to json.dumps above started failing in our instance today with an error like this:

TypeError: SomeType(FIRST_TYPE, 1) is not JSON serializable

Is anyone else seeing this? Note that using the same enum type within a message where we are not calling json.dumps directly works fine. 

Reply all
Reply to author
Forward
0 new messages