diff --git a/cps/static/js/table.js b/cps/static/js/table.js
index 1c828267..420478dc 100644
--- a/cps/static/js/table.js
+++ b/cps/static/js/table.js
@@ -65,11 +65,12 @@ $(function() {
});
});
-/*function TableActions (value, row, index) {
+/* Function for deleting domain restrictions */
+function TableActions (value, row, index) {
return [
"",
"",
""
].join("");
-}*/
+}
diff --git a/cps/templates/detail.html b/cps/templates/detail.html
index fcc4ac5f..b9765917 100644
--- a/cps/templates/detail.html
+++ b/cps/templates/detail.html
@@ -40,7 +40,7 @@
{% endif %}
{% endif %}
- {% if g.user.kindle_mail and g.user.is_authenticated and kindle_list %}
+ {% if g.user.kindle_mail and kindle_list %}
{% if kindle_list.__len__() == 1 %}
{{kindle_list[0]['text']}}
{% else %}
diff --git a/cps/ub.py b/cps/ub.py
index 22635849..bb055344 100644
--- a/cps/ub.py
+++ b/cps/ub.py
@@ -272,6 +272,7 @@ class Anonymous(AnonymousUserMixin, UserBase):
self.locale = data.locale
self.mature_content = data.mature_content
self.anon_browse = settings.config_anonbrowse
+ self.kindle_mail = data.kindle_mail
def role_admin(self):
return False
diff --git a/cps/web.py b/cps/web.py
index 7f2f01a7..db899b75 100644
--- a/cps/web.py
+++ b/cps/web.py
@@ -52,6 +52,7 @@ import gdriveutils
from redirect import redirect_back
from cps import lm, babel, ub, config, get_locale, language_table, app, db
from pagination import Pagination
+import unidecode
feature_support = dict()
@@ -873,15 +874,20 @@ def advanced_search():
searchterm = " + ".join(filter(None, searchterm))
q = q.filter()
if author_name:
- q = q.filter(db.Books.authors.any(db.Authors.name.ilike("%" + author_name + "%")))
+ q = q.filter(db.Books.authors.any(db.or_(db.Authors.name.ilike("%" + author_name + "%"),
+ db.Authors.name.ilike("%" + unidecode.unidecode(author_name)
+ + "%"))))
if book_title:
- q = q.filter(db.Books.title.ilike("%" + book_title + "%"))
+ q = q.filter(db.or_(db.Books.title.ilike("%" + book_title + "%"),
+ db.Books.title.ilike("%" + unidecode.unidecode(book_title) + "%")))
if pub_start:
q = q.filter(db.Books.pubdate >= pub_start)
if pub_end:
q = q.filter(db.Books.pubdate <= pub_end)
if publisher:
- q = q.filter(db.Books.publishers.any(db.Publishers.name.ilike("%" + publisher + "%")))
+ q = q.filter(db.Books.publishers.any(db.or_(db.Publishers.name.ilike("%" + publisher + "%"),
+ db.Publishers.name.ilike("%" + unidecode.unidecode(publisher)
+ + "%"),)))
for tag in include_tag_inputs:
q = q.filter(db.Books.tags.any(db.Tags.id == tag))
for tag in exclude_tag_inputs:
@@ -904,7 +910,9 @@ def advanced_search():
rating_low = int(rating_low) * 2
q = q.filter(db.Books.ratings.any(db.Ratings.rating >= rating_low))
if description:
- q = q.filter(db.Books.comments.any(db.Comments.text.ilike("%" + description + "%")))
+ q = q.filter(db.Books.comments.any(db.or_(db.Comments.text.ilike("%" + description + "%"),
+ db.Comments.text.ilike("%" + unidecode.unidecode(description)
+ + "%"))))
# search custom culumns
for c in cc:
@@ -919,7 +927,8 @@ def advanced_search():
db.cc_classes[c.id].value == custom_query))
else:
q = q.filter(getattr(db.Books, 'custom_column_'+str(c.id)).any(
- db.cc_classes[c.id].value.ilike("%" + custom_query + "%")))
+ db.or_(db.cc_classes[c.id].value.ilike("%" + custom_query + "%"),
+ db.cc_classes[c.id].value.ilike("%" + unidecode.unidecode(custom_query) + "%"))))
q = q.all()
ids = list()
for element in q:
diff --git a/cps/worker.py b/cps/worker.py
index 94f6a735..f00baa2e 100644
--- a/cps/worker.py
+++ b/cps/worker.py
@@ -475,9 +475,9 @@ class WorkerThread(threading.Thread):
except (MemoryError) as e:
self._handleError(u'Error sending email: ' + e.message)
return None
- except (smtplib.SMTPException) as e:
+ except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e:
if hasattr(e, "smtp_error"):
- text = e.smtp_error.replace("\n",'. ')
+ text = e.smtp_error.decode('utf-8').replace("\n",'. ')
elif hasattr(e, "message"):
text = e.message
else:
@@ -502,7 +502,6 @@ class WorkerThread(threading.Thread):
def _handleError(self, error_message):
app.logger.error(error_message)
- # self.queue[self.current]['status'] = STAT_FAIL
self.UIqueue[self.current]['stat'] = STAT_FAIL
self.UIqueue[self.current]['progress'] = "100 %"
self.UIqueue[self.current]['runtime'] = self._formatRuntime(
@@ -510,7 +509,6 @@ class WorkerThread(threading.Thread):
self.UIqueue[self.current]['message'] = error_message
def _handleSuccess(self):
- # self.queue[self.current]['status'] = STAT_FINISH_SUCCESS
self.UIqueue[self.current]['stat'] = STAT_FINISH_SUCCESS
self.UIqueue[self.current]['progress'] = "100 %"
self.UIqueue[self.current]['runtime'] = self._formatRuntime(