コード例 #1
0
def get_templates():
    """
    Get templates for all entity types.

    Summary:
        Get templates for all entity types

    Tags:
        dictionary

    Query Args:
        format (str): output format, ``csv`` or ``tsv``, default is tsv
        categories (str): list of entities' categories to include in the template
        exclude (str): list of entities' categories to exclude from the template

    Responses:
        200: Success.
    """
    file_format = flask.request.args.get("format", "tsv")
    response = flask.make_response(
        utils.get_all_template(
            file_format,
            categories=flask.request.args.get("categories"),
            exclude=flask.request.args.get("exclude"),
        ))
    suffix = "json" if file_format == "json" else "tar.gz"
    response.headers[
        "Content-Disposition"] = "attachment; filename=submission_templates.{}".format(
            suffix)
    return response
コード例 #2
0
ファイル: __init__.py プロジェクト: david4096/sheepdog
def get_templates():
    file_format = flask.request.args.get('format', 'tsv')
    response = flask.make_response(
        utils.get_all_template(file_format,
                               categories=flask.request.args.get('categories'),
                               exclude=flask.request.args.get('exclude')))
    suffix = 'json' if file_format == 'json' else 'tar.gz'
    response.headers['Content-Disposition'] = (
        'attachment; filename=submission_templates.{}'.format(suffix))
    return response