From f5e12328dc2114d24b0124cf69c0f9eb8c8ea071 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Mon, 11 May 2020 18:41:34 +0200 Subject: [PATCH 1/5] Fix for #1382 (Restrictions with "&" in it can't be deleted) --- cps/static/js/table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/static/js/table.js b/cps/static/js/table.js index 9be7e632..77045db3 100644 --- a/cps/static/js/table.js +++ b/cps/static/js/table.js @@ -124,7 +124,7 @@ $(function() { if (field === 3) { $.ajax ({ type: "Post", - data: "id=" + row.id + "&type=" + row.type + "&Element=" + row.Element, + data: "id=" + row.id + "&type=" + row.type + "&Element=" + encodeURIComponent(row.Element), url: path + "/../../ajax/deleterestriction/" + type, async: true, timeout: 900, From 33472567de9e61bb7c03a30e3eb7a68ab79e9cf6 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Mon, 11 May 2020 19:28:22 +0200 Subject: [PATCH 2/5] Improved Debug output on send email --- cps/worker.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cps/worker.py b/cps/worker.py index 25fe0f6f..dabec3e2 100644 --- a/cps/worker.py +++ b/cps/worker.py @@ -96,7 +96,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 @@ -426,10 +426,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}) @@ -501,7 +497,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"): @@ -509,11 +506,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): From f7269d8df2038b33f81fe6eb56ccd7f4bd36c60b Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Tue, 12 May 2020 14:39:13 +0200 Subject: [PATCH 3/5] Fix for #1385 (Private shelves are listed twice in the "Add to shelf" dropdown menu) --- cps/templates/detail.html | 4 ++-- cps/templates/search.html | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 8315a8f2..32b215f9 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -240,7 +240,7 @@ data-remove-href="{{ url_for('shelf.remove_from_shelf', book_id=entry.id, shelf_id=shelf.id) }}" data-shelf-action="add" > - {{shelf.name}} + {{shelf.name}}{% if shelf.is_public == 1 %} {{_('(Public)')}}{% endif %} {% endif %} @@ -257,7 +257,7 @@ > {{shelf.name}} + {% endif %}> {{shelf.name}}{% if shelf.is_public == 1 %} {{_('(Public)')}}{% endif %} {% endif %} {%endfor%} diff --git a/cps/templates/search.html b/cps/templates/search.html index 28eaf184..fa8176e9 100644 --- a/cps/templates/search.html +++ b/cps/templates/search.html @@ -15,14 +15,11 @@ From b48afa38acfbfa95c2cf66502bf65d9e730c4cc5 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Tue, 12 May 2020 14:44:57 +0200 Subject: [PATCH 4/5] Fix #1386 (Add asin to recognized identifiers) --- cps/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/db.py b/cps/db.py index 1e2b1af7..499765d1 100755 --- a/cps/db.py +++ b/cps/db.py @@ -100,7 +100,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) From 42abe28cc1c515239178d91c9abc1e413167decf Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Tue, 12 May 2020 16:13:56 +0200 Subject: [PATCH 5/5] Fix for #1389 (import ldap users with whitespaces) --- cps/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index d8f3225c..9665c8dc 100644 --- a/cps/web.py +++ b/cps/web.py @@ -316,7 +316,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: