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
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
6d0096c2
Commit
6d0096c2
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Renome to_jsonifyable method to to_dict
parent
22f6c6b4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/api/views.py
+8
-8
8 additions, 8 deletions
app/api/views.py
app/models.py
+2
-2
2 additions, 2 deletions
app/models.py
with
10 additions
and
10 deletions
app/api/views.py
+
8
−
8
View file @
6d0096c2
...
...
@@ -20,7 +20,7 @@ def admin_corpora():
return
abort
(
404
)
jsonifyable_corpora
=
[]
for
corpus
in
corpora
:
jsonifyable_corpora
.
append
(
corpus
.
to_
jsonifyable
())
jsonifyable_corpora
.
append
(
corpus
.
to_
dict
())
return
jsonify
(
jsonifyable_corpora
)
...
...
@@ -30,7 +30,7 @@ def admin_corpora():
def
admin_coprus
(
corpus_id
):
corpus
=
Corpus
.
query
.
filter_by
(
id
=
corpus_id
).
first
()
if
corpus
:
return
jsonify
(
corpus
.
to_
jsonifyable
())
return
jsonify
(
corpus
.
to_
dict
())
else
:
return
abort
(
404
)
...
...
@@ -50,7 +50,7 @@ def admin_jobs():
return
abort
(
404
)
jsonifyable_jobs
=
[]
for
job
in
jobs
:
jsonifyable_jobs
.
append
(
job
.
to_
jsonifyable
())
jsonifyable_jobs
.
append
(
job
.
to_
dict
())
return
jsonify
(
jsonifyable_jobs
)
...
...
@@ -60,7 +60,7 @@ def admin_jobs():
def
admin_job
(
job_id
):
job
=
Job
.
query
.
filter_by
(
id
=
job_id
).
first
()
if
job
:
return
jsonify
(
job
.
to_
jsonifyable
())
return
jsonify
(
job
.
to_
dict
())
else
:
return
abort
(
404
)
...
...
@@ -70,7 +70,7 @@ def admin_job(job_id):
def
corpora
():
jsonifyable_corpora
=
[]
for
corpus
in
current_user
.
corpora
.
all
():
jsonifyable_corpora
.
append
(
corpus
.
to_
jsonifyable
())
jsonifyable_corpora
.
append
(
corpus
.
to_
dict
())
return
jsonify
(
jsonifyable_corpora
)
...
...
@@ -79,7 +79,7 @@ def corpora():
def
corpus
(
corpus_id
):
corpus
=
current_user
.
corpora
.
filter_by
(
id
=
corpus_id
).
first
()
if
corpus
:
return
jsonify
(
corpus
.
to_
jsonifyable
())
return
jsonify
(
corpus
.
to_
dict
())
else
:
return
abort
(
404
)
...
...
@@ -89,7 +89,7 @@ def corpus(corpus_id):
def
jobs
():
jsonifyable_jobs
=
[]
for
job
in
current_user
.
jobs
.
all
():
jsonifyable_jobs
.
append
(
job
.
to_
jsonifyable
())
jsonifyable_jobs
.
append
(
job
.
to_
dict
())
return
jsonify
(
jsonifyable_jobs
)
...
...
@@ -98,6 +98,6 @@ def jobs():
def
job
(
job_id
):
job
=
current_user
.
jobs
.
filter_by
(
id
=
job_id
).
first
()
if
job
:
return
jsonify
(
job
.
to_
jsonifyable
())
return
jsonify
(
job
.
to_
dict
())
else
:
return
abort
(
404
)
This diff is collapsed.
Click to expand it.
app/models.py
+
2
−
2
View file @
6d0096c2
...
...
@@ -247,7 +247,7 @@ class Job(db.Model):
"""
return
'
<Job %r>
'
%
self
.
title
def
to_
jsonifyable
(
self
):
def
to_
dict
(
self
):
return
{
'
id
'
:
self
.
id
,
'
creation_date
'
:
self
.
creation_date
.
timestamp
(),
'
description
'
:
self
.
description
,
...
...
@@ -284,7 +284,7 @@ class Corpus(db.Model):
"""
return
'
<Corpus %r>
'
%
self
.
title
def
to_
jsonifyable
(
self
):
def
to_
dict
(
self
):
return
{
'
id
'
:
self
.
id
,
'
creation_date
'
:
self
.
creation_date
,
'
description
'
:
self
.
description
,
...
...
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