mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Use appropriate methods and variable naming
This commit is contained in:
parent
d480f92e30
commit
af947ee3bc
@ -504,13 +504,13 @@ class CorpusFile(db.Model):
|
|||||||
title = db.Column(db.String(255))
|
title = db.Column(db.String(255))
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
corpus_file = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
corpus_file_path = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
||||||
str(self.corpus.user_id),
|
str(self.corpus.user_id),
|
||||||
'corpora',
|
'corpora',
|
||||||
str(self.corpus_id),
|
str(self.corpus_id),
|
||||||
self.filename)
|
self.filename)
|
||||||
try:
|
try:
|
||||||
os.remove(corpus_file)
|
os.remove(corpus_file_path)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
db.session.delete(self)
|
db.session.delete(self)
|
||||||
@ -632,7 +632,10 @@ class Result(db.Model):
|
|||||||
def delete(self):
|
def delete(self):
|
||||||
result_file_path = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
result_file_path = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
||||||
self.file[0].dir)
|
self.file[0].dir)
|
||||||
shutil.rmtree(result_file_path)
|
try:
|
||||||
|
os.remove(result_file_path)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
db.session.delete(self)
|
db.session.delete(self)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user