Esempio n. 1
0
def graph_index(mid, page=None):
    module = str(request.args.get('module'))
    g = graph_from_elevator(mid)

    if not g:
        g = ''

    result = g.split('_\/')
    if len(result) > 1:
        if module == 'sub':
            tree_g = result[2]
            tree_stats = json.loads(result[3])
        else:
            tree_g = result[0]
            tree_stats = json.loads(result[1])

        response = make_response(tree_g)
        response.headers['Content-Type'] = 'text/xml'

        return response
    else:
        response = make_response('')
        response.headers['Content-Type'] = 'text/xml'

        return response
Esempio n. 2
0
def tree_stats_index(mid, page):
    module = str(request.args.get('module'))
    g = graph_from_elevator(mid)

    if not g:
        g = ''

    result = g.split('_\/')
    if len(result) > 1:
        if module == 'sub':
            tree_g = result[2]
            tree_stats = json.loads(result[3])
        else:
            tree_g = result[0]
            tree_stats = json.loads(result[1])
    else:
        tree_stats = {}

    tree_stats['spread_begin'] = ts2HMS(tree_stats['spread_begin'])#tree_stats['spread_begin'].strftime('%Y-%m-%d %H:%M:%S')
    tree_stats['spread_end'] = ts2HMS(tree_stats['spread_end'])#tree_stats['spread_end'].strftime('%Y-%m-%d %H:%M:%S')

    return jsonify(stats=tree_stats)