

@classmethod
@gen.coroutine
def _SendDeviceAlert(cls, client, user_id, viewpoint_id, badge, alert_text, exclude_device_id=None, sound=None):
    'Sends an APNS alert to the devices of the user who owns this NotificationManager. If\n    "exclude_device_id" is not None, skip that device. The alert will embed the viewpoint_id\n    as an extra "v" attribute if it\'s specified in the NotificationManager. This lets clients\n    determine which viewpoint triggered the alert.\n    '
    try:
        extra = ({
            'v': viewpoint_id,
        } if ((viewpoint_id is not None) and (alert_text is not None)) else None)
        (yield gen.Task(Device.PushNotification, client, user_id, alert_text, badge, exclude_device_id=exclude_device_id, extra=extra, sound=sound))
    except:
        logging.exception('failed to push notification to user %d', user_id)

dataset/ETHPy150Open viewfinderco/viewfinder/backend/op/alert_manager.py AlertManager._SendDeviceAlert/original