Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
4ffb10fd
Commit
4ffb10fd
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Return 404 if requested ressource does not exist.
parent
22f47e32
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/api/views.py
+7
-7
7 additions, 7 deletions
app/api/views.py
with
7 additions
and
7 deletions
app/api/views.py
+
7
−
7
View file @
4ffb10fd
from
flask
import
jsonify
from
flask
import
abort
,
jsonify
from
flask_login
import
current_user
,
login_required
from
.
import
api
...
...
@@ -20,8 +20,7 @@ def corpora():
def
corpus
(
corpus_id
):
corpus
=
current_user
.
corpora
.
filter_by
(
id
=
corpus_id
).
first
()
if
not
corpus
:
'''
This should return 404
'''
return
jsonify
(
None
)
return
abort
(
404
)
return
jsonify
({
'
id
'
:
corpus
.
id
,
'
creation_date
'
:
corpus
.
creation_date
,
'
description
'
:
corpus
.
description
,
...
...
@@ -36,7 +35,8 @@ def jobs():
jobs
.
append
({
'
id
'
:
job
.
id
,
'
creation_date
'
:
job
.
creation_date
.
timestamp
(),
'
description
'
:
job
.
description
,
'
end_date
'
:
job
.
end_date
.
timestamp
()
if
job
.
end_date
else
None
,
'
end_date
'
:
(
job
.
end_date
.
timestamp
()
if
job
.
end_date
else
None
),
'
mem_mb
'
:
job
.
mem_mb
,
'
n_cores
'
:
job
.
n_cores
,
'
service
'
:
job
.
service
,
...
...
@@ -52,12 +52,12 @@ def jobs():
def
job
(
job_id
):
job
=
current_user
.
jobs
.
filter_by
(
id
=
job_id
).
first
()
if
not
job
:
'''
This should return 404
'''
return
jsonify
(
None
)
return
abort
(
404
)
return
jsonify
({
'
id
'
:
job
.
id
,
'
creation_date
'
:
job
.
creation_date
.
timestamp
(),
'
description
'
:
job
.
description
,
'
end_date
'
:
job
.
end_date
.
timestamp
()
if
job
.
end_date
else
None
,
'
end_date
'
:
(
job
.
end_date
.
timestamp
()
if
job
.
end_date
else
None
),
'
mem_mb
'
:
job
.
mem_mb
,
'
n_cores
'
:
job
.
n_cores
,
'
service
'
:
job
.
service
,
...
...
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