checking item can faile with sqlalchemy.orm.exc.ObjectDeletedError

This commit is contained in:
j 2021-02-03 10:19:17 +01:00
parent 91fd3a61f5
commit 8766c7ef4e

View file

@ -733,7 +733,13 @@ class File(db.Model):
return re.sub(r'^\.|\.$|:|/|\?|<|>|\\|\*|\||"', '_', string) return re.sub(r'^\.|\.$|:|/|\?|<|>|\\|\*|\||"', '_', string)
prefs = settings.preferences prefs = settings.preferences
prefix = os.sep.join(os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/').split('/')) prefix = os.sep.join(os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/').split('/'))
if not self.item: not_item = False
try:
not_item = not self.item
except:
logger.debug('trying to move an item that was just deleted', exc_info=True)
not_item = True
if not_item:
return return
j = self.item.json(keys=['title', 'author', 'publisher', 'date', 'extension']) j = self.item.json(keys=['title', 'author', 'publisher', 'date', 'extension'])