Skip to content
Snippets Groups Projects
Commit 29f1be5c authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

Delete functions should not throw an error, if the ressource does not exists....

Delete functions should not throw an error, if the ressource does not exists. -> Consider it as deleted if does not exist
parent e83c7625
No related branches found
No related tags found
No related merge requests found
...@@ -5,16 +5,20 @@ def delete_corpus_(app, corpus_id): ...@@ -5,16 +5,20 @@ 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))
corpus.delete() pass
else:
corpus.delete()
def delete_corpus_file_(app, corpus_file_id): 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))
corpus_file.delete() pass
else:
corpus_file.delete()
def edit_corpus_file_(app, corpus_file_id): def edit_corpus_file_(app, corpus_file_id):
...@@ -22,4 +26,5 @@ def edit_corpus_file_(app, corpus_file_id): ...@@ -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))
corpus_file.insert_metadata() else:
corpus_file.insert_metadata()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment