Skip to content

Commit

Permalink
Make it work with python3
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 6, 2023
1 parent 3ea8ffb commit c9a3796
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion web/graphData.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def insert_graph_data(config, data, mail, ip, version):
except Exception:
return 'Invalid JSON nodes'

print "Accepted %d nodes and %d links." % (len(nodes), len(edges))
print("Accepted %d nodes and %d links.".format(len(nodes), len(edges)))

if len(nodes) == 0 or len(edges) == 0:
return 'No valid nodes or edges'
Expand Down
4 changes: 2 additions & 2 deletions web/graphPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_graph_json(G):
neighbors = len(G.neighbors(n))
if neighbors > max_neighbors:
max_neighbors = neighbors
print 'Max neighbors: %d' % max_neighbors
print('Max neighbors: %d', max_neighbors)

out_data = {
'created': int(time.time()),
Expand Down Expand Up @@ -97,4 +97,4 @@ def _gradient_color(ratio, colors):
g = a[1] + (b[1] - a[1]) * ratio
b = a[2] + (b[2] - a[2]) * ratio

return '#%02x%02x%02x' % (r, g, b)
return '#%02x%02x%02x' % (int(r), int(g), int(b))
4 changes: 2 additions & 2 deletions web/updateGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

def generate_graph(time_limit=60*60*3):
nodes, edges = load_graph_from_db(time_limit)
print '%d nodes, %d edges' % (len(nodes), len(edges))
print('%d nodes, %d edges'.format(len(nodes), len(edges)))

graph = graphPlotter.position_nodes(nodes, edges)
json = graphPlotter.get_graph_json(graph)

with open('static/graph.json', 'w') as f:
with open('./fc00.org/web/static/graph.json', 'w') as f:
f.write(json)


Expand Down
4 changes: 2 additions & 2 deletions web/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from graphData import insert_graph_data

app = Flask(__name__)
app.config.from_pyfile('web_config.cfg')
app.config.from_pyfile('../../web_config.cfg')

def get_ip():
try:
Expand All @@ -29,7 +29,7 @@ def page_about():

@app.route('/sendGraph', methods=['POST'])
def page_sendGraph():
print "Receiving graph from %s" % (request.remote_addr)
print("Receiving graph from %s".format(request.remote_addr))

data = request.form['data']
mail = request.form.get('mail', 'none')
Expand Down

0 comments on commit c9a3796

Please sign in to comment.