25
25
from . import forms
26
26
from . import app
27
27
28
+ ARANGO_PORT = 8529
29
+
28
30
@app .route ('/' )
29
31
def index ():
30
32
return flask .render_template ('index.html' )
@@ -959,7 +961,7 @@ def map_datapath_calculation_single(name, description, equation, author, InCalcu
959
961
calc_result_doc = check_collection_fields ('DataPath' , check_fields , calc_result )
960
962
if calc_result_doc is not None :
961
963
calculation_result_ids .add (calc_result_doc .next ()['_id' ])
962
- client = ArangoClient (protocol = 'http' , host = ' dbms' )
964
+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
963
965
db = client .db ('tdm' , username = 'root' , password = 'tdm' )
964
966
calculation_collection = db .collection ('Calculation' )
965
967
calculation_exists = calculation_collection .find ({'name' : name })
@@ -1032,7 +1034,7 @@ def map_datapath_single_by_key(basepath_key, matchpath_key, author, weight, anno
1032
1034
matchpath = fetch_datapath (matchpath_key )
1033
1035
if not matchpath :
1034
1036
raise Exception ('Specified matching DataPath not found!' )
1035
- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1037
+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
1036
1038
db = client .db ('tdm' , username = 'root' , password = 'tdm' )
1037
1039
datapath_matches = db .collection ('DataPathMatch' )
1038
1040
datapath_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
1057
1059
1058
1060
def check_collection_fields (collection , fields , value , return_single = True , db = None ):
1059
1061
if db is None :
1060
- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1062
+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
1061
1063
db = client .db ('tdm' , username = 'root' , password = 'tdm' )
1062
1064
collection_ref = db .collection (collection )
1063
1065
return_val = None
@@ -1077,7 +1079,7 @@ def check_collection_fields(collection, fields, value, return_single=True, db=No
1077
1079
1078
1080
def add_mapping (edge_collection , from_id , to_id , body = None , check_bidirectional = True , db = None ):
1079
1081
if db is None :
1080
- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1082
+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
1081
1083
db = client .db ('tdm' , username = 'root' , password = 'tdm' )
1082
1084
collection_ref = db .collection (edge_collection )
1083
1085
mapping = collection_ref .find ({'_from' : from_id , '_to' : to_id })
@@ -1221,7 +1223,7 @@ def fetch_dump_mappings():
1221
1223
1222
1224
def query_db (query , bind_vars = None , unlist = True ):
1223
1225
"""Generically query database."""
1224
- client = ArangoClient (protocol = 'http' , host = ' dbms' )
1226
+ client = ArangoClient (hosts = 'http:// dbms:{}' . format ( ARANGO_PORT ) )
1225
1227
db = client .db ('tdm' , username = 'root' ,password = 'tdm' )
1226
1228
cursor = db .aql .execute (query , bind_vars = bind_vars )
1227
1229
# TODO: Pass as generator instead of fill array
0 commit comments