Merge branch 'master' into Develop

This commit is contained in:
Ozzieisaacs 2020-05-12 16:16:04 +02:00
commit 47641eee59
3 changed files with 8 additions and 10 deletions

View File

@ -101,7 +101,7 @@ class Identifiers(Base):
return self.type return self.type
def __repr__(self): def __repr__(self):
if self.type == "amazon": if self.type == "amazon" or self.type == "asin":
return u"https://amzn.com/{0}".format(self.val) return u"https://amzn.com/{0}".format(self.val)
elif self.type == "isbn": elif self.type == "isbn":
return u"https://www.worldcat.org/isbn/{0}".format(self.val) return u"https://www.worldcat.org/isbn/{0}".format(self.val)

View File

@ -331,7 +331,7 @@ def import_ldap_users():
match = re.search("([a-zA-Z0-9-]+)=%s", config.config_ldap_user_object, re.IGNORECASE | re.UNICODE) match = re.search("([a-zA-Z0-9-]+)=%s", config.config_ldap_user_object, re.IGNORECASE | re.UNICODE)
if match: if match:
match_filter = match.group(1) match_filter = match.group(1)
match = re.search(match_filter + "=([[\d\w-]+)", user, re.IGNORECASE | re.UNICODE) match = re.search(match_filter + "=([\d\s\w-]+)", user, re.IGNORECASE | re.UNICODE)
if match: if match:
user = match.group(1) user = match.group(1)
else: else:

View File

@ -99,7 +99,7 @@ def get_attachment(bookpath, filename):
data = file_.read() data = file_.read()
file_.close() file_.close()
except IOError as e: except IOError as e:
log.exception(e) # traceback.print_exc() log.exception(e)
log.error(u'The requested file could not be read. Maybe wrong permissions?') log.error(u'The requested file could not be read. Maybe wrong permissions?')
return None return None
@ -459,10 +459,6 @@ class WorkerThread(threading.Thread):
if self.last >= 20: if self.last >= 20:
self._delete_completed_tasks() self._delete_completed_tasks()
# progress=100%, runtime=0, and status finished # progress=100%, runtime=0, and status finished
log.debug("Last " + str(self.last))
log.debug("Current " + str(self.current))
log.debug("id" + str(self.id))
self.id += 1 self.id += 1
starttime = datetime.now() starttime = datetime.now()
self.queue.append({'starttime': starttime, 'taskType': TASK_UPLOAD}) self.queue.append({'starttime': starttime, 'taskType': TASK_UPLOAD})
@ -534,7 +530,8 @@ class WorkerThread(threading.Thread):
smtplib.stderr = org_smtpstderr smtplib.stderr = org_smtpstderr
except (MemoryError) as e: except (MemoryError) as e:
self._handleError(u'Error sending email: ' + e.message) log.exception(e)
self._handleError(u'MemoryError sending email: ' + str(e))
return None return None
except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e: except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e:
if hasattr(e, "smtp_error"): if hasattr(e, "smtp_error"):
@ -542,11 +539,12 @@ class WorkerThread(threading.Thread):
elif hasattr(e, "message"): elif hasattr(e, "message"):
text = e.message text = e.message
else: else:
log.exception(e)
text = '' text = ''
self._handleError(u'Error sending email: ' + text) self._handleError(u'Smtplib Error sending email: ' + text)
return None return None
except (socket.error) as e: except (socket.error) as e:
self._handleError(u'Error sending email: ' + e.strerror) self._handleError(u'Socket Error sending email: ' + e.strerror)
return None return None
def _handleError(self, error_message): def _handleError(self, error_message):