示例#1
0
 def get_all_results(self, ctx):
     print "[LOG] reading all results"
     rets = db_api.get_all_results()
     # TODO(kun) object
     return [{"id": ret.id,
              "uuid": ret.uuid,
              "name": ret.name,
              "unit": ret.unit,
              "data": ret.data,
              "rtype": ret.rtype} for ret in rets]
示例#2
0
def run(config):
    """
    uuid: pprint it
    list: pprint all
    uuid and html: generate_result_html
    list and html: generate_multiple_result_html
    """
    if config.get("list"):
        rets = db_api.get_all_results()
        if config.get("html"):
            report.generate_multiple_result_html(rets)
        elif config.get("short"):
            for ret in rets:
                print ret.uuid
        else:
            map(report.pprint_result, rets)
    elif config.get("uuid"):
        ret = db_api.result_get(config["uuid"])
        if config.get("html"):
            report.generate_result_html(ret)
        else:
            report.pprint_result(ret)