1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-04 17:16:21 +00:00

Fix opds and error logging in mail

This commit is contained in:
Ozzie Isaacs 2021-03-21 11:54:39 +01:00
parent 59ebc1af8a
commit 130a4ed2d3
4 changed files with 8 additions and 6 deletions

View File

@ -94,7 +94,7 @@ def feed_cc_search(query):
@opds.route("/opds/search", methods=["GET"]) @opds.route("/opds/search", methods=["GET"])
@requires_basic_auth_if_no_ano @requires_basic_auth_if_no_ano
def feed_normal_search(): def feed_normal_search():
return feed_search(request.args.get("query").strip()) return feed_search(request.args.get("query", "").strip())
@opds.route("/opds/new") @opds.route("/opds/new")

View File

@ -172,6 +172,7 @@ class TaskEmail(CalibreTask):
log.debug_or_exception(e) log.debug_or_exception(e)
self._handleError(u'MemoryError sending email: ' + str(e)) self._handleError(u'MemoryError sending email: ' + str(e))
except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e: except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e:
log.debug_or_exception(e)
if hasattr(e, "smtp_error"): if hasattr(e, "smtp_error"):
text = e.smtp_error.decode('utf-8').replace("\n", '. ') text = e.smtp_error.decode('utf-8').replace("\n", '. ')
elif hasattr(e, "message"): elif hasattr(e, "message"):
@ -179,10 +180,10 @@ class TaskEmail(CalibreTask):
elif hasattr(e, "args"): elif hasattr(e, "args"):
text = '\n'.join(e.args) text = '\n'.join(e.args)
else: else:
log.debug_or_exception(e)
text = '' text = ''
self._handleError(u'Smtplib Error sending email: ' + text) self._handleError(u'Smtplib Error sending email: ' + text)
except (socket.error) as e: except (socket.error) as e:
log.debug_or_exception(e)
self._handleError(u'Socket Error sending email: ' + e.strerror) self._handleError(u'Socket Error sending email: ' + e.strerror)

View File

@ -11,18 +11,18 @@
<link rel="up" <link rel="up"
href="{{url_for('opds.feed_index')}}" href="{{url_for('opds.feed_index')}}"
type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/>
{% if pagination.has_prev %} {% if pagination and pagination.has_prev %}
<link rel="first" <link rel="first"
href="{{request.script_root + request.path}}" href="{{request.script_root + request.path}}"
type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/>
{% endif %} {% endif %}
{% if pagination.has_next %} {% if pagination and pagination.has_next %}
<link rel="next" <link rel="next"
title="{{_('Next')}}" title="{{_('Next')}}"
href="{{ request.script_root + request.path }}?offset={{ pagination.next_offset }}" href="{{ request.script_root + request.path }}?offset={{ pagination.next_offset }}"
type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/>
{% endif %} {% endif %}
{% if pagination.has_prev %} {% if pagination and pagination.has_prev %}
<link rel="previous" <link rel="previous"
href="{{request.script_root + request.path}}?offset={{ pagination.previous_offset }}" href="{{request.script_root + request.path}}?offset={{ pagination.previous_offset }}"
type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/>
@ -30,7 +30,7 @@
<link rel="search" <link rel="search"
href="{{url_for('opds.feed_osd')}}" href="{{url_for('opds.feed_osd')}}"
type="application/opensearchdescription+xml"/> type="application/opensearchdescription+xml"/>
<!--link title="{{_('Search')}}" type="application/atom+xml" href="{{url_for('opds.feed_normal_search')}}?query={searchTerms}" rel="search"/--> <link type="application/atom+xml" rel="search" title="{{_('Search')}}" href="{{url_for('opds.feed_cc_search')}}/{searchTerms}" />
<title>{{instance}}</title> <title>{{instance}}</title>
<author> <author>
<name>{{instance}}</name> <name>{{instance}}</name>

View File

@ -8,6 +8,7 @@
<link rel="search" <link rel="search"
href="{{url_for('opds.feed_osd')}}" href="{{url_for('opds.feed_osd')}}"
type="application/opensearchdescription+xml"/> type="application/opensearchdescription+xml"/>
<link type="application/atom+xml" rel="search" title="{{_('Search')}}" href="{{url_for('opds.feed_cc_search')}}/{searchTerms}" />
<title>{{instance}}</title> <title>{{instance}}</title>
<author> <author>
<name>{{instance}}</name> <name>{{instance}}</name>