mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Renome to_jsonifyable method to to_dict
This commit is contained in:
parent
22f6c6b4b6
commit
6d0096c2cc
@ -20,7 +20,7 @@ def admin_corpora():
|
|||||||
return abort(404)
|
return abort(404)
|
||||||
jsonifyable_corpora = []
|
jsonifyable_corpora = []
|
||||||
for corpus in corpora:
|
for corpus in corpora:
|
||||||
jsonifyable_corpora.append(corpus.to_jsonifyable())
|
jsonifyable_corpora.append(corpus.to_dict())
|
||||||
return jsonify(jsonifyable_corpora)
|
return jsonify(jsonifyable_corpora)
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ def admin_corpora():
|
|||||||
def admin_coprus(corpus_id):
|
def admin_coprus(corpus_id):
|
||||||
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
||||||
if corpus:
|
if corpus:
|
||||||
return jsonify(corpus.to_jsonifyable())
|
return jsonify(corpus.to_dict())
|
||||||
else:
|
else:
|
||||||
return abort(404)
|
return abort(404)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def admin_jobs():
|
|||||||
return abort(404)
|
return abort(404)
|
||||||
jsonifyable_jobs = []
|
jsonifyable_jobs = []
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
jsonifyable_jobs.append(job.to_jsonifyable())
|
jsonifyable_jobs.append(job.to_dict())
|
||||||
return jsonify(jsonifyable_jobs)
|
return jsonify(jsonifyable_jobs)
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ def admin_jobs():
|
|||||||
def admin_job(job_id):
|
def admin_job(job_id):
|
||||||
job = Job.query.filter_by(id=job_id).first()
|
job = Job.query.filter_by(id=job_id).first()
|
||||||
if job:
|
if job:
|
||||||
return jsonify(job.to_jsonifyable())
|
return jsonify(job.to_dict())
|
||||||
else:
|
else:
|
||||||
return abort(404)
|
return abort(404)
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ def admin_job(job_id):
|
|||||||
def corpora():
|
def corpora():
|
||||||
jsonifyable_corpora = []
|
jsonifyable_corpora = []
|
||||||
for corpus in current_user.corpora.all():
|
for corpus in current_user.corpora.all():
|
||||||
jsonifyable_corpora.append(corpus.to_jsonifyable())
|
jsonifyable_corpora.append(corpus.to_dict())
|
||||||
return jsonify(jsonifyable_corpora)
|
return jsonify(jsonifyable_corpora)
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ def corpora():
|
|||||||
def corpus(corpus_id):
|
def corpus(corpus_id):
|
||||||
corpus = current_user.corpora.filter_by(id=corpus_id).first()
|
corpus = current_user.corpora.filter_by(id=corpus_id).first()
|
||||||
if corpus:
|
if corpus:
|
||||||
return jsonify(corpus.to_jsonifyable())
|
return jsonify(corpus.to_dict())
|
||||||
else:
|
else:
|
||||||
return abort(404)
|
return abort(404)
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ def corpus(corpus_id):
|
|||||||
def jobs():
|
def jobs():
|
||||||
jsonifyable_jobs = []
|
jsonifyable_jobs = []
|
||||||
for job in current_user.jobs.all():
|
for job in current_user.jobs.all():
|
||||||
jsonifyable_jobs.append(job.to_jsonifyable())
|
jsonifyable_jobs.append(job.to_dict())
|
||||||
return jsonify(jsonifyable_jobs)
|
return jsonify(jsonifyable_jobs)
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +98,6 @@ def jobs():
|
|||||||
def job(job_id):
|
def job(job_id):
|
||||||
job = current_user.jobs.filter_by(id=job_id).first()
|
job = current_user.jobs.filter_by(id=job_id).first()
|
||||||
if job:
|
if job:
|
||||||
return jsonify(job.to_jsonifyable())
|
return jsonify(job.to_dict())
|
||||||
else:
|
else:
|
||||||
return abort(404)
|
return abort(404)
|
||||||
|
@ -247,7 +247,7 @@ class Job(db.Model):
|
|||||||
"""
|
"""
|
||||||
return '<Job %r>' % self.title
|
return '<Job %r>' % self.title
|
||||||
|
|
||||||
def to_jsonifyable(self):
|
def to_dict(self):
|
||||||
return {'id': self.id,
|
return {'id': self.id,
|
||||||
'creation_date': self.creation_date.timestamp(),
|
'creation_date': self.creation_date.timestamp(),
|
||||||
'description': self.description,
|
'description': self.description,
|
||||||
@ -284,7 +284,7 @@ class Corpus(db.Model):
|
|||||||
"""
|
"""
|
||||||
return '<Corpus %r>' % self.title
|
return '<Corpus %r>' % self.title
|
||||||
|
|
||||||
def to_jsonifyable(self):
|
def to_dict(self):
|
||||||
return {'id': self.id,
|
return {'id': self.id,
|
||||||
'creation_date': self.creation_date,
|
'creation_date': self.creation_date,
|
||||||
'description': self.description,
|
'description': self.description,
|
||||||
|
Loading…
Reference in New Issue
Block a user