Example #1
0
def stats(table, zone=None, format="csv"):

    reports = request.args.get('reports', None)
    if not reports:
        abort(400)
    try:
        reports = map(int, reports.split(','))
    except ValueError:
        logging.error("bad format for report id")
        abort(400)

    this_report = ReportType.factory(format)
    this_report.init(zone)
    this_report.write_header()

    logging.info("table id is %s ", table)
    logging.info("and we see %s ", FustionTablesNames.all().filter('table_id =', table).fetch(1))
    logging.info("and zone %s ", zone)
    logging.info("and format %s ", format)

    reports = [Report.get_by_id(x) for x in reports]
    for r in reports:
        if not r:
            logging.error("report not found")
            abort(404)

        stats = this_report.get_stats(r, table)

        for s in stats:
            this_report.write_row(r, s, table)

    this_report.write_footer()
    return this_report.response("report_%s" % table)
Example #2
0
def stats(table, zone=None, format="csv"):

    reports = request.args.get('reports', None)
    if not reports:
        abort(400)
    try:
        reports = map(int, reports.split(','))
    except ValueError:
        logging.error("bad format for report id")
        abort(400)

    this_report = ReportType.factory(format)
    this_report.init(zone)
    this_report.write_header()

    logging.info("table id is %s ", table)
    logging.info("and we see %s ",
                 FustionTablesNames.all().filter('table_id =', table).fetch(1))
    logging.info("and zone %s ", zone)
    logging.info("and format %s ", format)

    reports = [Report.get_by_id(x) for x in reports]
    for r in reports:
        if not r:
            logging.error("report not found")
            abort(404)

        stats = this_report.get_stats(r, table)

        for s in stats:
            this_report.write_row(r, s, table)

    this_report.write_footer()
    return this_report.response("report_%s" % table)
 def get_polygon_name(self, table, id):
         all_table_names = FustionTablesNames.all()
         filtered_table_names = all_table_names.filter('table_id =', table)
         table_names=filtered_table_names.fetch(1)[0].as_dict()
         name = table_names.get(id, id)
         return name
 def get_polygon_name(table, id):
     all_table_name = FustionTablesNames.all()
     filtered_table_names = all_table_names.filter("table_id =", table)
     table_names = filtered_table_names.fetch(1)[0].as_dict()
     name = table_names.get(id, id)
Example #5
0
 def get_polygon_name(table, id):
     all_table_name = FustionTablesNames.all()
     filtered_table_names = all_table_names.filter('table_id =', table)
     table_names=filtered_table_names.fetch(1)[0].as_dict()
     name = table_names.get(id, id)