mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
26 lines
884 B
Python
26 lines
884 B
Python
|
from app.models import Corpus, CorpusFile
|
||
|
|
||
|
|
||
|
def delete_corpus_(app, corpus_id):
|
||
|
with app.app_context():
|
||
|
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
||
|
if corpus is None:
|
||
|
raise Exception('Corpus {} not found!'.format(corpus_id))
|
||
|
corpus.delete()
|
||
|
|
||
|
|
||
|
def delete_corpus_file_(app, corpus_file_id):
|
||
|
with app.app_context():
|
||
|
corpus_file = CorpusFile.query.filter_by(id=corpus_file_id).first()
|
||
|
if corpus_file is None:
|
||
|
raise Exception('Corpus file {} not found!'.format(corpus_file_id))
|
||
|
corpus_file.delete()
|
||
|
|
||
|
|
||
|
def edit_corpus_file_(app, corpus_file_id):
|
||
|
with app.app_context():
|
||
|
corpus_file = CorpusFile.query.filter_by(id=corpus_file_id).first()
|
||
|
if corpus_file is None:
|
||
|
raise Exception('Corpus file {} not found!'.format(corpus_file_id))
|
||
|
corpus_file.insert_metadata()
|