add some debug logs

This commit is contained in:
Patrick Jentsch 2019-10-30 09:02:45 +01:00
parent 8b8939b17a
commit e2268f9234

View File

@ -412,6 +412,7 @@ class CorpusFile(db.Model):
def delete(self): def delete(self):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.warning('Called CorpusFile.delete')
path = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'], path = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'],
self.dir, self.dir,
self.filename) self.filename)
@ -459,13 +460,20 @@ class Corpus(db.Model):
def delete(self): def delete(self):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.warning('Called Corpus.delete')
for corpus_file in self.files: for corpus_file in self.files:
corpus_file.delete() corpus_file.delete()
logger.warning('bis hierhin und nicht weiter')
logger.warning('base_dir: {}'.format(current_app.config['OPAQUE_STORAGE_DIRECTORY']))
logger.warning('user_id: {}'.format(self.user_id))
logger.warning('id: {}'.format(self.id))
path = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'], path = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'],
self.user_id, self.user_id,
'corpora', 'corpora',
self.id) self.id)
logger.warning(path)
try: try:
logger.warning('Try to remove {}'.format(path))
shutil.rmtree(path) shutil.rmtree(path)
except: except:
logger.warning('[ERROR] Corpus.delete') logger.warning('[ERROR] Corpus.delete')