Commit 93c9b3b8 authored by Ismail Moumni's avatar Ismail Moumni
Browse files

modifing server functions

parent acd7f739
Pipeline #1418 failed with stage
in 13 seconds
...@@ -115,7 +115,7 @@ def get_generators(): ...@@ -115,7 +115,7 @@ def get_generators():
generators[result[0]] = [result] generators[result[0]] = [result]
def list_gen(): def list_generator():
database = database_connection() database = database_connection()
generators = {} generators = {}
sql_get_generators = "SELECT id, tool from generators" sql_get_generators = "SELECT id, tool from generators"
......
...@@ -59,7 +59,7 @@ def query_process(sock: socket, query: dict): ...@@ -59,7 +59,7 @@ def query_process(sock: socket, query: dict):
# Function takes 2 parameters addr : IP address of client and data : Generators values # Function takes 2 parameters addr : IP address of client and data : Generators values
# Function return a valid insert query # Function return a valid insert query
def query_fields(addr, data): def query_fields(addr, data):
__RDOS_Tool__ = db.list_gen() __RDOS_Tool__ = db.list_generator()
sa = __RDOS_Tool__.get(list(data.keys())[0]) sa = __RDOS_Tool__.get(list(data.keys())[0])
lm = list((data.values())) lm = list((data.values()))
s = {"id": "", "idGenerator": "", "IP": "", "timeSubmitted": "", "timeExecuted": "", s = {"id": "", "idGenerator": "", "IP": "", "timeSubmitted": "", "timeExecuted": "",
...@@ -145,7 +145,7 @@ def match_query_dict(biblio: dict, data: dict): ...@@ -145,7 +145,7 @@ def match_query_dict(biblio: dict, data: dict):
# Function check_and_complete_parameters verifies json send from client to server by matching it with database query # Function check_and_complete_parameters verifies json send from client to server by matching it with database query
# Function input takes a dictionary # Function input takes a dictionary
# Function output returns query if it matches with database query keys if not it raises an error # Function output returns query if it matches with database query keys if not it raises an error
def check_and_complete_parameters(data): def check_and_complete_parameters(data: dict):
if data is not None: if data is not None:
tool = list(data.keys())[0] tool = list(data.keys())[0]
s = db.getParameters({tool}) s = db.getParameters({tool})
...@@ -162,7 +162,7 @@ def check_and_complete_parameters(data): ...@@ -162,7 +162,7 @@ def check_and_complete_parameters(data):
else: else:
raise Exception("Error Database") raise Exception("Error Database")
else: else:
raise Exception("Dictionnaire Vide!!") return Exception("Dictionnaire Vide!!" %s , tool)
# check_and_replace checks query with default_parameters of generator and replaces empty values with default_parameters # check_and_replace checks query with default_parameters of generator and replaces empty values with default_parameters
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment