2525from .import forms
2626from .import app
2727
28+ ARANGO_PORT = 8529
29+
2830@app .route ('/' )
2931def index ():
3032return flask .render_template ('index.html' )
@@ -959,7 +961,7 @@ def map_datapath_calculation_single(name, description, equation, author, InCalcu
959961calc_result_doc = check_collection_fields ('DataPath' ,check_fields ,calc_result )
960962if calc_result_doc is not None :
961963calculation_result_ids .add (calc_result_doc .next ()['_id' ])
962- client = ArangoClient (protocol = 'http' , host = ' dbms' )
964+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
963965db = client .db ('tdm' ,username = 'root' ,password = 'tdm' )
964966calculation_collection = db .collection ('Calculation' )
965967calculation_exists = calculation_collection .find ({'name' :name })
@@ -1032,7 +1034,7 @@ def map_datapath_single_by_key(basepath_key, matchpath_key, author, weight, anno
10321034matchpath = fetch_datapath (matchpath_key )
10331035if not matchpath :
10341036raise Exception ('Specified matching DataPath not found!' )
1035- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1037+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
10361038db = client .db ('tdm' ,username = 'root' ,password = 'tdm' )
10371039datapath_matches = db .collection ('DataPathMatch' )
10381040datapath_match_exist = datapath_matches .find ({'_from' :basepath ['_id' ],'_to' :matchpath ['_id' ]})
@@ -1057,7 +1059,7 @@ def map_datapath_single_by_key(basepath_key, matchpath_key, author, weight, anno
10571059
10581060def check_collection_fields (collection ,fields ,value ,return_single = True ,db = None ):
10591061if db is None :
1060- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1062+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
10611063db = client .db ('tdm' ,username = 'root' ,password = 'tdm' )
10621064collection_ref = db .collection (collection )
10631065return_val = None
@@ -1077,7 +1079,7 @@ def check_collection_fields(collection, fields, value, return_single=True, db=No
10771079
10781080def add_mapping (edge_collection ,from_id ,to_id ,body = None ,check_bidirectional = True ,db = None ):
10791081if db is None :
1080- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1082+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
10811083db = client .db ('tdm' ,username = 'root' ,password = 'tdm' )
10821084collection_ref = db .collection (edge_collection )
10831085mapping = collection_ref .find ({'_from' :from_id ,'_to' :to_id })
@@ -1221,7 +1223,7 @@ def fetch_dump_mappings():
12211223
12221224def query_db (query ,bind_vars = None ,unlist = True ):
12231225"""Generically query database."""
1224- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1226+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
12251227db = client .db ('tdm' ,username = 'root' ,password = 'tdm' )
12261228cursor = db .aql .execute (query ,bind_vars = bind_vars )
12271229# TODO: Pass as generator instead of fill array