Beispiel #1
0
def get_hash(opsys=None, release=None, since=None, to=None):
    if to:
        to = datetime.datetime.strptime(to, "%Y-%m-%d")
        since = datetime.datetime.strptime(since, "%Y-%m-%d")

        report_hash = queries.get_all_report_hashes(db, opsys=opsys,
                                                    opsys_releases=release,
                                                    date_from=since,
                                                    date_to=to)

    elif since:
        since = datetime.datetime.strptime(since, "%Y-%m-%d")

        report_hash = queries.get_all_report_hashes(db, opsys=opsys,
                                                    opsys_releases=release,
                                                    date_from=since)

    elif release:
        report_hash = queries.get_all_report_hashes(db, opsys=opsys,
                                                    opsys_releases=release)

    elif opsys:
        report_hash = queries.get_all_report_hashes(db, opsys=opsys)
    else:
        report_hash = queries.get_all_report_hashes(db)

    r_hash = []

    for rh in report_hash:
        r_hash.append(rh.hash)

    if request_wants_json():
        return jsonify({"data": r_hash})

    return abort(405)
Beispiel #2
0
def get_hash(os=None, release=None, since=None, to=None):
    if to:
        to = datetime.datetime.strptime(to, "%Y-%m-%d")
        since = datetime.datetime.strptime(since, "%Y-%m-%d")

        report_hash = queries.get_all_report_hashes(db, opsys=os,
                                                    opsys_releases=release,
                                                    date_from=since,
                                                    date_to=to)

    elif since:
        since = datetime.datetime.strptime(since, "%Y-%m-%d")

        report_hash = queries.get_all_report_hashes(db, opsys=os,
                                                    opsys_releases=release,
                                                    date_from=since)

    elif release:
        report_hash = queries.get_all_report_hashes(db, opsys=os,
                                                    opsys_releases=release)

    elif os:
        report_hash = queries.get_all_report_hashes(db, opsys=os)
    else:
        report_hash = queries.get_all_report_hashes(db)

    r_hash = []

    for item in report_hash:
        r_hash.append(item.hash)

    if request_wants_json():
        return jsonify({"data": r_hash})
    else:
        abort(405)