diff --git a/cps/db.py b/cps/db.py index 2601988a..882c792e 100755 --- a/cps/db.py +++ b/cps/db.py @@ -101,7 +101,7 @@ class Identifiers(Base): return self.type def __repr__(self): - if self.type == "amazon": + if self.type == "amazon" or self.type == "asin": return u"https://amzn.com/{0}".format(self.val) elif self.type == "isbn": return u"https://www.worldcat.org/isbn/{0}".format(self.val) diff --git a/cps/web.py b/cps/web.py index 06ccfa36..7d3a80bb 100644 --- a/cps/web.py +++ b/cps/web.py @@ -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) if match: 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: user = match.group(1) else: diff --git a/cps/worker.py b/cps/worker.py index 3da5d4b0..fc08e6b1 100644 --- a/cps/worker.py +++ b/cps/worker.py @@ -99,7 +99,7 @@ def get_attachment(bookpath, filename): data = file_.read() file_.close() 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?') return None @@ -459,10 +459,6 @@ class WorkerThread(threading.Thread): if self.last >= 20: self._delete_completed_tasks() # 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 starttime = datetime.now() self.queue.append({'starttime': starttime, 'taskType': TASK_UPLOAD}) @@ -534,7 +530,8 @@ class WorkerThread(threading.Thread): smtplib.stderr = org_smtpstderr 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 except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e: if hasattr(e, "smtp_error"): @@ -542,11 +539,12 @@ class WorkerThread(threading.Thread): elif hasattr(e, "message"): text = e.message else: + log.exception(e) text = '' - self._handleError(u'Error sending email: ' + text) + self._handleError(u'Smtplib Error sending email: ' + text) return None except (socket.error) as e: - self._handleError(u'Error sending email: ' + e.strerror) + self._handleError(u'Socket Error sending email: ' + e.strerror) return None def _handleError(self, error_message):