mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2026-10-06 00:31:09 +00:00
Delete functions should not throw an error, if the ressource does not exists. -> Consider it as deleted if does not exist
This commit is contained in:
1 parent
e83c762551
commit
29f1be5c80
1 file changed
+7
-2
@@ -5,7 +5,9 @@ def delete_corpus_(app, corpus_id):
|
|||||||
with app.app_context():
|
with app.app_context():
|
||||||
corpus = Corpus.query.get(corpus_id)
|
corpus = Corpus.query.get(corpus_id)
|
||||||
if corpus is None:
|
if corpus is None:
|
||||||
raise Exception('Corpus {} not found!'.format(corpus_id))
|
# raise Exception('Corpus {} not found!'.format(corpus_id))
|
||||||
|
pass
|
||||||
|
else:
|
||||||
corpus.delete()
|
corpus.delete()
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +15,9 @@ def delete_corpus_file_(app, corpus_file_id):
|
|||||||
with app.app_context():
|
with app.app_context():
|
||||||
corpus_file = CorpusFile.query.get(corpus_file_id)
|
corpus_file = CorpusFile.query.get(corpus_file_id)
|
||||||
if corpus_file is None:
|
if corpus_file is None:
|
||||||
raise Exception('Corpus file {} not found!'.format(corpus_file_id))
|
# raise Exception('Corpus file {} not found!'.format(corpus_file_id))
|
||||||
|
pass
|
||||||
|
else:
|
||||||
corpus_file.delete()
|
corpus_file.delete()
|
||||||
|
|
||||||
|
|
||||||
@@ -22,4 +26,5 @@ def edit_corpus_file_(app, corpus_file_id):
|
|||||||
corpus_file = CorpusFile.query.get(corpus_file_id)
|
corpus_file = CorpusFile.query.get(corpus_file_id)
|
||||||
if corpus_file is None:
|
if corpus_file is None:
|
||||||
raise Exception('Corpus file {} not found!'.format(corpus_file_id))
|
raise Exception('Corpus file {} not found!'.format(corpus_file_id))
|
||||||
|
else:
|
||||||
corpus_file.insert_metadata()
|
corpus_file.insert_metadata()
|
||||||
Reference in new issue
Block a user