def getFieldExtractorForReadMessage(self, jsonMessage, objectToRead):
        if 'field' not in jsonMessage:
            raise MalformedMessageException("missing 'field'")

        field = jsonMessage['field']

        if not isinstance(field, str):
            raise MalformedMessageException("fieldname not a string")

        field = intern(field)

        try:
            fieldDef = getattr(getObjectClass(objectToRead), field)
        except:
            raise InvalidFieldException()

        if not Decorators.isPropertyToExpose(fieldDef):
            raise InvalidFieldException()

        def getter(x):
            return getattr(x, field)
        return getter
dataset/ETHPy150Open ufora/ufora/ufora/BackendGateway/SubscribableWebObjects/MessageProcessor.py/MessageProcessor.getFieldExtractorForReadMessage/original