コード例 #1
0
def transfer_workflow(workflow):
    """ Enqueue workflow for transfer to an attached USB storage device.

    Requires that the `python-dbus` package is installed.

    Once the transfer was succesfully enqueued, watch for the
    :py:data:`spreadsplug.web.tasks.on_transfer_started` which is emitted
    when the transfer actually started and subsequently
    :py:data:`spreadsplug.web.tasks.on_transfer_progressed` and
    :py:data:`spreadsplug.web.tasks.on_transfer_completed`.

    :param workflow:    UUID or slug for the workflow to be transferred
    :type workflow:     str

    :status 200:        When the transfer was successfully enqueued.
    :status 500:        When the `python-dbus` package was not found.
    :status 503:        When no removable USB device could be found for
                        mounting.
    """
    try:
        stick = find_stick()
    except ImportError:
        raise ApiException(
            "The transfer feature requires that the `python-dbus` module is "
            "installed on the system.", error_type='transfer')
    if stick is None:
        raise ApiException(
            "Could not find a removable devices to transfer to."
            "If you have connected one, make sure that it is formatted with "
            "the FAT32 file system", 503, error_type='transfer')
    from tasks import transfer_to_stick
    transfer_to_stick(workflow.id, app.config['base_path'])
    return 'OK'
コード例 #2
0
ファイル: web.py プロジェクト: 5up3rD4n1/spreads
def transfer_workflow(workflow):
    """ Transfer workflow to an attached USB storage device.

    """
    try:
        stick = find_stick()
    except ImportError:
        return jsonify({"error": "Missing package 'python-dbus', "
                                 "please install."})
    if stick is None:
        return jsonify({"error": "Could not find removable device"}), 503
    from tasks import transfer_to_stick
    transfer_to_stick(workflow.id, app.config['base_path'])
    return 'OK'
コード例 #3
0
def transfer_workflow(workflow):
    """ Transfer workflow to an attached USB storage device.

    """
    try:
        stick = find_stick()
    except ImportError:
        return jsonify({"error": "Missing package 'python-dbus', "
                                 "please install."})
    if stick is None:
        return jsonify({"error": "Could not find removable device"}), 503
    from tasks import transfer_to_stick
    transfer_to_stick(workflow.id, app.config['base_path'])
    return 'OK'
コード例 #4
0
ファイル: web.py プロジェクト: duerig/spreads
def transfer_workflow(workflow):
    """ Transfer workflow to an attached USB storage device.

    """
    try:
        stick = find_stick()
    except ImportError:
        raise ApiException(
            "The transfer feature requires that the `python-dbus` module is "
            "installed on the system.", error_type='transfer')
    if stick is None:
        raise ApiException(
            "Could not find a removable devices to transfer to."
            "If you have connected one, make sure that it is formatted with "
            "the FAT32 file system", 503, error_type='transfer')
    from tasks import transfer_to_stick
    transfer_to_stick(workflow.id, app.config['base_path'])
    return 'OK'