Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D-GENIES
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
genotoul-bioinfo
d-genies
D-GENIES
Commits
2360f9dd
Commit
2360f9dd
authored
7 years ago
by
Floreal Cabanettes
Browse files
Options
Downloads
Patches
Plain Diff
Fix seurity breaches, Fixes
#121
parent
7a39c212
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dgenies/views.py
+22
-11
22 additions, 11 deletions
src/dgenies/views.py
with
22 additions
and
11 deletions
src/dgenies/views.py
+
22
−
11
View file @
2360f9dd
...
@@ -107,9 +107,13 @@ def launch_analysis():
...
@@ -107,9 +107,13 @@ def launch_analysis():
errors
.
append
(
"
Id of job not given
"
)
errors
.
append
(
"
Id of job not given
"
)
form_pass
=
False
form_pass
=
False
if
email
==
""
and
MODE
==
"
webserver
"
:
if
MODE
==
"
webserver
"
:
errors
.
append
(
"
Email not given
"
)
if
email
==
""
:
form_pass
=
False
errors
.
append
(
"
Email not given
"
)
form_pass
=
False
elif
not
re
.
match
(
r
"
^[\w\-]+@[\w\-]{2,}\.[a-z]{2,4}
"
,
email
):
errors
.
append
(
"
Email is invalid
"
)
form_pass
=
False
if
file_target
==
""
:
if
file_target
==
""
:
errors
.
append
(
"
No target fasta selected
"
)
errors
.
append
(
"
No target fasta selected
"
)
form_pass
=
False
form_pass
=
False
...
@@ -133,20 +137,27 @@ def launch_analysis():
...
@@ -133,20 +137,27 @@ def launch_analysis():
query_name
=
os
.
path
.
splitext
(
file_query
.
replace
(
"
.gz
"
,
""
))[
0
]
if
file_query_type
==
"
local
"
else
None
query_name
=
os
.
path
.
splitext
(
file_query
.
replace
(
"
.gz
"
,
""
))[
0
]
if
file_query_type
==
"
local
"
else
None
query_path
=
os
.
path
.
join
(
app
.
config
[
"
UPLOAD_FOLDER
"
],
upload_folder
,
file_query
)
\
query_path
=
os
.
path
.
join
(
app
.
config
[
"
UPLOAD_FOLDER
"
],
upload_folder
,
file_query
)
\
if
file_query_type
==
"
local
"
else
file_query
if
file_query_type
==
"
local
"
else
file_query
if
file_query_type
==
"
local
"
and
not
os
.
path
.
exists
(
query_path
):
errors
.
append
(
"
Query file not correct!
"
)
form_pass
=
False
query
=
Fasta
(
name
=
query_name
,
path
=
query_path
,
type_f
=
file_query_type
)
query
=
Fasta
(
name
=
query_name
,
path
=
query_path
,
type_f
=
file_query_type
)
target_name
=
os
.
path
.
splitext
(
file_target
.
replace
(
"
.gz
"
,
""
))[
0
]
if
file_target_type
==
"
local
"
else
None
target_name
=
os
.
path
.
splitext
(
file_target
.
replace
(
"
.gz
"
,
""
))[
0
]
if
file_target_type
==
"
local
"
else
None
target_path
=
os
.
path
.
join
(
app
.
config
[
"
UPLOAD_FOLDER
"
],
upload_folder
,
file_target
)
\
target_path
=
os
.
path
.
join
(
app
.
config
[
"
UPLOAD_FOLDER
"
],
upload_folder
,
file_target
)
\
if
file_target_type
==
"
local
"
else
file_target
if
file_target_type
==
"
local
"
else
file_target
if
file_target_type
==
"
local
"
and
not
os
.
path
.
exists
(
target_path
):
errors
.
append
(
"
Target file not correct!
"
)
form_pass
=
False
target
=
Fasta
(
name
=
target_name
,
path
=
target_path
,
type_f
=
file_target_type
)
target
=
Fasta
(
name
=
target_name
,
path
=
target_path
,
type_f
=
file_target_type
)
# Launch job:
if
form_pass
:
job
=
JobManager
(
id_job
,
email
,
query
,
target
,
mailer
)
# Launch job:
if
MODE
==
"
webserver
"
:
job
=
JobManager
(
id_job
,
email
,
query
,
target
,
mailer
)
job
.
launch
()
if
MODE
==
"
webserver
"
:
else
:
job
.
launch
()
job
.
launch_standalone
()
else
:
return
jsonify
({
"
success
"
:
True
,
"
redirect
"
:
url_for
(
"
.status
"
,
id_job
=
id_job
)})
job
.
launch_standalone
()
else
:
return
jsonify
({
"
success
"
:
True
,
"
redirect
"
:
url_for
(
"
.status
"
,
id_job
=
id_job
)})
if
not
form_pass
:
return
jsonify
({
"
success
"
:
False
,
"
errors
"
:
errors
})
return
jsonify
({
"
success
"
:
False
,
"
errors
"
:
errors
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment