mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
add directory creation
This commit is contained in:
parent
e2268f9234
commit
617cc06125
@ -60,10 +60,8 @@ def corpus(corpus_id):
|
||||
@main.route('/corpora/<int:corpus_id>/delete')
|
||||
@login_required
|
||||
def delete_corpus(corpus_id):
|
||||
delete_thread = threading.Thread(
|
||||
target=background_delete_corpus,
|
||||
args=(current_app._get_current_object(), corpus_id)
|
||||
)
|
||||
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
||||
delete_thread = threading.Thread(corpus.delete())
|
||||
delete_thread.start()
|
||||
flash('Corpus has been deleted!')
|
||||
return redirect(url_for('main.dashboard'))
|
||||
@ -121,6 +119,16 @@ def dashboard():
|
||||
title=create_corpus_form.title.data)
|
||||
db.session.add(corpus)
|
||||
db.session.commit()
|
||||
dir = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'],
|
||||
str(corpus.user_id),
|
||||
'corpora',
|
||||
str(corpus.id))
|
||||
try:
|
||||
os.makedirs(dir)
|
||||
except OSError:
|
||||
flash('OSError!')
|
||||
db.session.remove(corpus)
|
||||
db.session.commit()
|
||||
flash('Corpus created!')
|
||||
return redirect(url_for('main.dashboard'))
|
||||
return render_template('main/dashboard.html.j2',
|
||||
|
Loading…
Reference in New Issue
Block a user