Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Julien David
rdos
Commits
93c9b3b8
Commit
93c9b3b8
authored
Oct 12, 2020
by
Ismail Moumni
Browse files
modifing server functions
parent
acd7f739
Pipeline
#1418
failed with stage
in 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
softwares/database/database.py
View file @
93c9b3b8
...
...
@@ -115,7 +115,7 @@ def get_generators():
generators
[
result
[
0
]]
=
[
result
]
def
list_gen
():
def
list_gen
erator
():
database
=
database_connection
()
generators
=
{}
sql_get_generators
=
"SELECT id, tool from generators"
...
...
softwares/server/server.py
View file @
93c9b3b8
...
...
@@ -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 return a valid insert query
def
query_fields
(
addr
,
data
):
__RDOS_Tool__
=
db
.
list_gen
()
__RDOS_Tool__
=
db
.
list_gen
erator
()
sa
=
__RDOS_Tool__
.
get
(
list
(
data
.
keys
())[
0
])
lm
=
list
((
data
.
values
()))
s
=
{
"id"
:
""
,
"idGenerator"
:
""
,
"IP"
:
""
,
"timeSubmitted"
:
""
,
"timeExecuted"
:
""
,
...
...
@@ -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 input takes a dictionary
# 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
:
tool
=
list
(
data
.
keys
())[
0
]
s
=
db
.
getParameters
({
tool
})
...
...
@@ -162,7 +162,7 @@ def check_and_complete_parameters(data):
else
:
raise
Exception
(
"Error Database"
)
else
:
r
aise
Exception
(
"Dictionnaire Vide!!"
)
r
eturn
Exception
(
"Dictionnaire Vide!!"
%
s
,
tool
)
# check_and_replace checks query with default_parameters of generator and replaces empty values with default_parameters
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment