Commit 5864637f authored by Ozzieisaacs's avatar Ozzieisaacs

Merge branch 'master' into Develop

parents f6c04b9b ec6b346c
...@@ -964,7 +964,8 @@ def get_updater_status(): ...@@ -964,7 +964,8 @@ def get_updater_status():
"8": _(u'Update failed:') + u' ' + _(u'HTTP Error'), "8": _(u'Update failed:') + u' ' + _(u'HTTP Error'),
"9": _(u'Update failed:') + u' ' + _(u'Connection error'), "9": _(u'Update failed:') + u' ' + _(u'Connection error'),
"10": _(u'Update failed:') + u' ' + _(u'Timeout while establishing connection'), "10": _(u'Update failed:') + u' ' + _(u'Timeout while establishing connection'),
"11": _(u'Update failed:') + u' ' + _(u'General error') "11": _(u'Update failed:') + u' ' + _(u'General error'),
"12": _(u'Update failed:') + u' ' + _(u'Update File Could Not be Saved in Temp Dir')
} }
status['text'] = text status['text'] = text
updater_thread.status = 0 updater_thread.status = 0
......
...@@ -253,6 +253,7 @@ def feed_ratings(book_id): ...@@ -253,6 +253,7 @@ def feed_ratings(book_id):
return render_xml_template('feed.xml', entries=entries, pagination=pagination) return render_xml_template('feed.xml', entries=entries, pagination=pagination)
@opds.route("/opds/formats") @opds.route("/opds/formats")
@requires_basic_auth_if_no_ano @requires_basic_auth_if_no_ano
def feed_formatindex(): def feed_formatindex():
...@@ -276,6 +277,7 @@ def feed_format(book_id): ...@@ -276,6 +277,7 @@ def feed_format(book_id):
db.Books, db.Books.data.any(db.Data.format == book_id.upper()), [db.Books.timestamp.desc()]) db.Books, db.Books.data.any(db.Data.format == book_id.upper()), [db.Books.timestamp.desc()])
return render_xml_template('feed.xml', entries=entries, pagination=pagination) return render_xml_template('feed.xml', entries=entries, pagination=pagination)
@opds.route("/opds/language") @opds.route("/opds/language")
@opds.route("/opds/language/") @opds.route("/opds/language/")
@requires_basic_auth_if_no_ano @requires_basic_auth_if_no_ano
...@@ -308,17 +310,12 @@ def feed_languages(book_id): ...@@ -308,17 +310,12 @@ def feed_languages(book_id):
return render_xml_template('feed.xml', entries=entries, pagination=pagination) return render_xml_template('feed.xml', entries=entries, pagination=pagination)
@opds.route("/opds/shelfindex", defaults={'public': 0}) @opds.route("/opds/shelfindex")
@opds.route("/opds/shelfindex/<string:public>")
@requires_basic_auth_if_no_ano @requires_basic_auth_if_no_ano
def feed_shelfindex(public): def feed_shelfindex():
off = request.args.get("offset") or 0 off = request.args.get("offset") or 0
if public != 0: shelf = g.shelves_access
shelf = g.public_shelfes number = len(shelf)
number = len(shelf)
else:
shelf = g.user.shelf
number = shelf.count()
pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page, pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page,
number) number)
return render_xml_template('feed.xml', listelements=shelf, folder='opds.feed_shelf', pagination=pagination) return render_xml_template('feed.xml', listelements=shelf, folder='opds.feed_shelf', pagination=pagination)
...@@ -343,9 +340,9 @@ def feed_shelf(book_id): ...@@ -343,9 +340,9 @@ def feed_shelf(book_id):
for book in books_in_shelf: for book in books_in_shelf:
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first() cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
result.append(cur_book) result.append(cur_book)
pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page, pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page,
len(result)) len(result))
return render_xml_template('feed.xml', entries=result, pagination=pagination) return render_xml_template('feed.xml', entries=result, pagination=pagination)
@opds.route("/opds/download/<book_id>/<book_format>/") @opds.route("/opds/download/<book_id>/<book_format>/")
......
...@@ -24,7 +24,7 @@ import signal ...@@ -24,7 +24,7 @@ import signal
import socket import socket
try: try:
from gevent.pyewsgi import WSGIServer from gevent.pywsgi import WSGIServer
from gevent.pool import Pool from gevent.pool import Pool
from gevent import __version__ as _version from gevent import __version__ as _version
VERSION = 'Gevent ' + _version VERSION = 'Gevent ' + _version
...@@ -171,6 +171,7 @@ class WebServer(object): ...@@ -171,6 +171,7 @@ class WebServer(object):
except Exception as ex: except Exception as ex:
log.error("Error starting server: %s", ex) log.error("Error starting server: %s", ex)
print("Error starting server: %s" % ex) print("Error starting server: %s" % ex)
self.stop()
return False return False
finally: finally:
self.wsgiserver = None self.wsgiserver = None
......
...@@ -204,21 +204,34 @@ def create_shelf(): ...@@ -204,21 +204,34 @@ def create_shelf():
shelf.is_public = 1 shelf.is_public = 1
shelf.name = to_save["title"] shelf.name = to_save["title"]
shelf.user_id = int(current_user.id) shelf.user_id = int(current_user.id)
existing_shelf = ub.session.query(ub.Shelf).filter(
or_((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1), is_shelf_name_unique = False
(ub.Shelf.name == to_save["title"]) & (ub.Shelf.user_id == int(current_user.id)))).first() if shelf.is_public == 1:
if existing_shelf: is_shelf_name_unique = ub.session.query(ub.Shelf) \
flash(_(u"A shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") .filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1)) \
.first() is None
if not is_shelf_name_unique:
flash(_(u"A public shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error")
else: else:
is_shelf_name_unique = ub.session.query(ub.Shelf) \
.filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 0) & (ub.Shelf.user_id == int(current_user.id))) \
.first() is None
if not is_shelf_name_unique:
flash(_(u"A private shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error")
if is_shelf_name_unique:
try: try:
ub.session.add(shelf) ub.session.add(shelf)
ub.session.commit() ub.session.commit()
flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success") flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success")
return redirect(url_for('shelf.show_shelf', shelf_id = shelf.id ))
except Exception: except Exception:
flash(_(u"There was an error"), category="error") flash(_(u"There was an error"), category="error")
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"), page="shelfcreate") return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Create a Shelf"), page="shelfcreate")
else: else:
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"), page="shelfcreate") return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Create a Shelf"), page="shelfcreate")
@shelf.route("/shelf/edit/<int:shelf_id>", methods=["GET", "POST"]) @shelf.route("/shelf/edit/<int:shelf_id>", methods=["GET", "POST"])
...@@ -227,13 +240,26 @@ def edit_shelf(shelf_id): ...@@ -227,13 +240,26 @@ def edit_shelf(shelf_id):
shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first() shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()
if request.method == "POST": if request.method == "POST":
to_save = request.form.to_dict() to_save = request.form.to_dict()
existing_shelf = ub.session.query(ub.Shelf).filter(
or_((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1), is_shelf_name_unique = False
(ub.Shelf.name == to_save["title"]) & (ub.Shelf.user_id == int(current_user.id)))).filter( if shelf.is_public == 1:
ub.Shelf.id != shelf_id).first() is_shelf_name_unique = ub.session.query(ub.Shelf) \
if existing_shelf: .filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1)) \
flash(_(u"A shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") .filter(ub.Shelf.id != shelf_id) \
.first() is None
if not is_shelf_name_unique:
flash(_(u"A public shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error")
else: else:
is_shelf_name_unique = ub.session.query(ub.Shelf) \
.filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 0) & (ub.Shelf.user_id == int(current_user.id))) \
.filter(ub.Shelf.id != shelf_id) \
.first() is None
if not is_shelf_name_unique:
flash(_(u"A private shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error")
if is_shelf_name_unique:
shelf.name = to_save["title"] shelf.name = to_save["title"]
if "is_public" in to_save: if "is_public" in to_save:
shelf.is_public = 1 shelf.is_public = 1
......
...@@ -365,7 +365,7 @@ $( '#logout' ).parent().addClass( 'dropdown' ).appendTo( '.profileDropli' ); ...@@ -365,7 +365,7 @@ $( '#logout' ).parent().addClass( 'dropdown' ).appendTo( '.profileDropli' );
// Remove the modals except from some areas where they are needed // Remove the modals except from some areas where they are needed
bodyClass = $( 'body' ).attr( 'class' ).split(' '); bodyClass = $( 'body' ).attr( 'class' ).split(' ');
modalWanted = ['admin', 'editbook', 'config', 'uiconfig']; modalWanted = ['admin', 'editbook', 'config', 'uiconfig', 'me', 'edituser'];
if ( $.inArray( bodyClass[0], modalWanted) != -1 ) { if ( $.inArray( bodyClass[0], modalWanted) != -1 ) {
} else { } else {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<th>{{_('Downloads')}}</th> <th>{{_('Downloads')}}</th>
<th class="hidden-xs">{{_('Admin')}}</th> <th class="hidden-xs">{{_('Admin')}}</th>
<th class="hidden-xs">{{_('Download')}}</th> <th class="hidden-xs">{{_('Download')}}</th>
<th class="hidden-xs">{{_('View eBooks')}}</th> <th class="hidden-xs">{{_('View Books')}}</th>
<th class="hidden-xs">{{_('Upload')}}</th> <th class="hidden-xs">{{_('Upload')}}</th>
<th class="hidden-xs">{{_('Edit')}}</th> <th class="hidden-xs">{{_('Edit')}}</th>
</tr> </tr>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<td class="hidden-xs">{{email.mail_from}}</td> <td class="hidden-xs">{{email.mail_from}}</td>
</tr> </tr>
</table> </table>
<div class="btn btn-default" id="admin_edit_email"><a href="{{url_for('admin.edit_mailsettings')}}">{{_('Change SMTP settings')}}</a></div> <div class="btn btn-default" id="admin_edit_email"><a href="{{url_for('admin.edit_mailsettings')}}">{{_('Edit E-mail Server Settings')}}</a></div>
</div> </div>
</div> </div>
......
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
<div class="more-stuff"> <div class="more-stuff">
{% if g.user.is_authenticated %} {% if g.user.is_authenticated %}
{% if g.user.shelf.all() or g.public_shelfes %} {% if g.user.shelf.all() or g.shelves_access %}
<div id="shelf-actions" class="btn-toolbar" role="toolbar"> <div id="shelf-actions" class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group" aria-label="Add to shelves"> <div class="btn-group" role="group" aria-label="Add to shelves">
<button id="add-to-shelf" type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="add-to-shelf" type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</li> </li>
{% endif %} {% endif %}
{%endfor%} {%endfor%}
{% for shelf in g.public_shelfes %} {% for shelf in g.shelves_access %}
{% if not shelf.id in books_shelfs %} {% if not shelf.id in books_shelfs %}
<li> <li>
<a href="{{ url_for('shelf.add_to_shelf', book_id=entry.id, shelf_id=shelf.id) }}" <a href="{{ url_for('shelf.add_to_shelf', book_id=entry.id, shelf_id=shelf.id) }}"
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
</a> </a>
{% endif %} {% endif %}
{%endfor%} {%endfor%}
{% for shelf in g.public_shelfes %} {% for shelf in g.shelves_access %}
{% if shelf.id in books_shelfs %} {% if shelf.id in books_shelfs %}
<a href="{{ url_for('shelf.remove_from_shelf', book_id=entry.id, shelf_id=shelf.id) }}" <a href="{{ url_for('shelf.remove_from_shelf', book_id=entry.id, shelf_id=shelf.id) }}"
data-add-href="{{ url_for('shelf.add_to_shelf', book_id=entry.id, shelf_id=shelf.id) }}" data-add-href="{{ url_for('shelf.add_to_shelf', book_id=entry.id, shelf_id=shelf.id) }}"
......
...@@ -75,7 +75,11 @@ ...@@ -75,7 +75,11 @@
{% endif %} {% endif %}
{% for entry in listelements %} {% for entry in listelements %}
<entry> <entry>
{% if entry.__class__.__name__ == 'Shelf' and entry.is_public == 1 %}
<title>{{entry.name}} {{_('(Public)')}}</title>
{% else %}
<title>{{entry.name}}</title> <title>{{entry.name}}</title>
{% endif %}
<id>{{ url_for(folder, book_id=entry.id) }}</id> <id>{{ url_for(folder, book_id=entry.id) }}</id>
<link rel="subsection" type="application/atom+xml;profile=opds-catalog" href="{{url_for(folder, book_id=entry.id)}}"/> <link rel="subsection" type="application/atom+xml;profile=opds-catalog" href="{{url_for(folder, book_id=entry.id)}}"/>
</entry> </entry>
......
File mode changed from 100755 to 100644
...@@ -108,19 +108,10 @@ ...@@ -108,19 +108,10 @@
<content type="text">{{_('Books ordered by file formats')}}</content> <content type="text">{{_('Books ordered by file formats')}}</content>
</entry> </entry>
<entry> <entry>
<title>{{_('Public Shelves')}}</title> <title>{{_('Shelves')}}</title>
<link href="{{url_for('opds.feed_shelfindex', public='public')}}" type="application/atom+xml;profile=opds-catalog"/> <link href="{{url_for('opds.feed_shelfindex')}}" type="application/atom+xml;profile=opds-catalog"/>
<id>{{url_for('opds.feed_shelfindex', public="public")}}</id>
<updated>{{ current_time }}</updated>
<content type="text">{{_('Books organized in public shelfs, visible to everyone')}}</content>
</entry>
{% if not current_user.is_anonymous %}
<entry>
<title>{{_('Your Shelves')}}</title>
<link href="{{url_for('opds.feed_shelfindex')}}" type="application/atom+xml;profile=opds-catalog"/>
<id>{{url_for('opds.feed_shelfindex')}}</id> <id>{{url_for('opds.feed_shelfindex')}}</id>
<updated>{{ current_time }}</updated> <updated>{{ current_time }}</updated>
<content type="text">{{_("User's own shelfs, only visible to the current user himself")}}</content> <content type="text">{{_('Books organized in shelves')}}</content>
</entry> </entry>
{% endif %}
</feed> </feed>
...@@ -125,22 +125,20 @@ ...@@ -125,22 +125,20 @@
<nav class="navigation"> <nav class="navigation">
<ul class="list-unstyled" id="scnd-nav" intent in-standard-append="nav.navigation" in-mobile-after="#main-nav" in-mobile-class="nav navbar-nav"> <ul class="list-unstyled" id="scnd-nav" intent in-standard-append="nav.navigation" in-mobile-after="#main-nav" in-mobile-class="nav navbar-nav">
<li class="nav-head hidden-xs">{{_('Browse')}}</li> <li class="nav-head hidden-xs">{{_('Browse')}}</li>
{% if g.user.check_visibility(1024) %} <!-- ToDo: eliminate -->
{%endif%}
{% for element in sidebar %} {% for element in sidebar %}
{% if g.user.check_visibility(element['visibility']) and element['public'] %} {% if g.user.check_visibility(element['visibility']) and element['public'] %}
<li id="nav_{{element['id']}}" {% if page == element['page'] %}class="active"{% endif %}><a href="{{url_for(element['link'], data=element['page'], sort='new')}}"><span class="glyphicon {{element['glyph']}}"></span>{{_(element['text'])}}</a></li> <li id="nav_{{element['id']}}" {% if page == element['page'] %}class="active"{% endif %}><a href="{{url_for(element['link'], data=element['page'], sort='new')}}"><span class="glyphicon {{element['glyph']}}"></span>{{_(element['text'])}}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if g.user.is_authenticated or g.allow_anonymous %} {% if g.user.is_authenticated or g.allow_anonymous %}
<li class="nav-head hidden-xs public-shelves">{{_('Public Shelves')}}</li> <li class="nav-head hidden-xs public-shelves">{{_('Shelves')}}</li>
{% for shelf in g.public_shelfes %} {% for shelf in g.shelves_access %}
<li><a href="{{url_for('shelf.show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list public_shelf"></span> {{shelf.name|shortentitle(40)}}</a></li> <li><a href="{{url_for('shelf.show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list shelf"></span>{{shelf.name|shortentitle(40)}}{% if shelf.is_public == 1 %} {{_('(Public)')}}{% endif %}</a></li>
{% endfor %} {% endfor %}
<li class="nav-head hidden-xs your-shelves">{{_('Your Shelves')}}</li> <!--li class="nav-head hidden-xs your-shelves">{{_('Your Shelves')}}</li>
{% for shelf in g.user.shelf %} {% for shelf in g.user.shelf %}
<li><a href="{{url_for('shelf.show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list private_shelf"></span> {{shelf.name|shortentitle(40)}}</a></li> <li><a href="{{url_for('shelf.show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list private_shelf"></span>{{shelf.name|shortentitle(40)}}{% if shelf.is_public == 1 %} {{_('(Public)')}}{% endif %}</a></li>
{% endfor %} {% endfor %}-->
{% if not g.user.is_anonymous %} {% if not g.user.is_anonymous %}
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('shelf.create_shelf')}}">{{_('Create a Shelf')}}</a></li> <li id="nav_createshelf" class="create-shelf"><a href="{{url_for('shelf.create_shelf')}}">{{_('Create a Shelf')}}</a></li>
<li id="nav_about" {% if page == 'stat' %}class="active"{% endif %}><a href="{{url_for('about.stats')}}"><span class="glyphicon glyphicon-info-sign"></span> {{_('About')}}</a></li> <li id="nav_about" {% if page == 'stat' %}class="active"{% endif %}><a href="{{url_for('about.stats')}}"><span class="glyphicon glyphicon-info-sign"></span> {{_('About')}}</a></li>
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title hidden" id="h1">{{_('Select allowed/denied Tags')}}</h4> <h4 class="modal-title hidden" id="h1">{{_('Select Allowed/Denied Tags')}}</h4>
<h4 class="modal-title hidden" id="h2">{{_('Select allowed/denied Custom Column values')}}</h4> <h4 class="modal-title hidden" id="h2">{{_('Select Allowed/Denied Custom Column Values')}}</h4>
<h4 class="modal-title hidden" id="h3">{{_('Select allowed/denied Tags of user')}}</h4> <h4 class="modal-title hidden" id="h3">{{_('Select Allowed/Denied Tags of User')}}</h4>
<h4 class="modal-title hidden" id="h4">{{_('Select allowed/denied Custom Column values of user')}}</h4> <h4 class="modal-title hidden" id="h4">{{_('Select Allowed/Denied Custom Column Values of User')}}</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-no-bordered" id="restrict-elements-table" data-id-field="id" data-show-header="false" data-editable-mode="inline"> <table class="table table-no-bordered" id="restrict-elements-table" data-id-field="id" data-show-header="false" data-editable-mode="inline">
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% else %} {% else %}
<h2>{{entries|length}} {{_('Results for:')}} {{searchterm}}</h2> <h2>{{entries|length}} {{_('Results for:')}} {{searchterm}}</h2>
{% if g.user.is_authenticated %} {% if g.user.is_authenticated %}
{% if g.user.shelf.all() or g.public_shelfes %} {% if g.user.shelf.all() or g.shelves_access %}
<div id="shelf-actions" class="btn-toolbar" role="toolbar"> <div id="shelf-actions" class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group" aria-label="Add to shelves"> <div class="btn-group" role="group" aria-label="Add to shelves">
<button id="add-to-shelf" type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="add-to-shelf" type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<li><a href="{{ url_for('shelf.search_to_shelf', shelf_id=shelf.id) }}"> {{shelf.name}}</a></li> <li><a href="{{ url_for('shelf.search_to_shelf', shelf_id=shelf.id) }}"> {{shelf.name}}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for shelf in g.public_shelfes %} {% for shelf in g.shelves_access %}
<li><a href="{{ url_for('shelf.search_to_shelf', shelf_id=shelf.id) }}">{{shelf.name}}</a></li> <li><a href="{{ url_for('shelf.search_to_shelf', shelf_id=shelf.id) }}">{{shelf.name}}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
......
...@@ -80,8 +80,8 @@ ...@@ -80,8 +80,8 @@
<label for="Show_detail_random">{{_('Show Random Books')}}</label> <label for="Show_detail_random">{{_('Show Random Books')}}</label>
</div> </div>
{% if ( g.user and g.user.role_admin() and not new_user ) %} {% if ( g.user and g.user.role_admin() and not new_user ) %}
<a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/denied Tags')}}</a> <a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add Allowed/Denied Tags')}}</a>
<a href="#" id="get_user_column_values" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/denied custom column values')}}</a> <a href="#" id="get_user_column_values" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/Denied Custom Column Values')}}</a>
{% endif %} {% endif %}
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -114,6 +114,9 @@ class Updater(threading.Thread): ...@@ -114,6 +114,9 @@ class Updater(threading.Thread):
except (requests.exceptions.RequestException, zipfile.BadZipFile): except (requests.exceptions.RequestException, zipfile.BadZipFile):
self.status = 11 self.status = 11
log.info(u'General error') log.info(u'General error')
except (IOError, OSError):
self.status = 12
log.info(u'Update File Could Not be Saved in Temp Dir')
self.pause() self.pause()
return False return False
......
...@@ -37,7 +37,7 @@ from flask import render_template, request, redirect, send_from_directory, make_ ...@@ -37,7 +37,7 @@ from flask import render_template, request, redirect, send_from_directory, make_
from flask_babel import gettext as _ from flask_babel import gettext as _
from flask_login import login_user, logout_user, login_required, current_user from flask_login import login_user, logout_user, login_required, current_user
from sqlalchemy.exc import IntegrityError from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import text, func, true, false, not_, and_, exists from sqlalchemy.sql.expression import text, func, true, false, not_, and_, exists, or_
from werkzeug.exceptions import default_exceptions from werkzeug.exceptions import default_exceptions
from werkzeug.datastructures import Headers from werkzeug.datastructures import Headers
from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.security import generate_password_hash, check_password_hash
...@@ -268,7 +268,7 @@ def before_request(): ...@@ -268,7 +268,7 @@ def before_request():
g.allow_upload = config.config_uploading g.allow_upload = config.config_uploading
g.current_theme = config.config_theme g.current_theme = config.config_theme
g.config_authors_max = config.config_authors_max g.config_authors_max = config.config_authors_max
g.public_shelfes = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1).order_by(ub.Shelf.name).all() g.shelves_access = ub.session.query(ub.Shelf).filter(or_(ub.Shelf.is_public == 1, ub.Shelf.user_id == current_user.id)).order_by(ub.Shelf.name).all()
if not config.db_configured and request.endpoint not in ('admin.basic_configuration', 'login') and '/static/' not in request.path: if not config.db_configured and request.endpoint not in ('admin.basic_configuration', 'login') and '/static/' not in request.path:
return redirect(url_for('admin.basic_configuration')) return redirect(url_for('admin.basic_configuration'))
...@@ -1083,11 +1083,11 @@ def serve_book(book_id, book_format, anyname): ...@@ -1083,11 +1083,11 @@ def serve_book(book_id, book_format, anyname):
else: else:
return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format) return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format)
@web.route("/download/<int:book_id>/<book_format>", defaults={'anyname': 'None'})
@web.route("/download/<int:book_id>/<book_format>") @web.route("/download/<int:book_id>/<book_format>/<anyname>")
@login_required_if_no_ano @login_required_if_no_ano
@download_required @download_required
def download_link(book_id, book_format): def download_link(book_id, book_format, anyname):
return get_download_link(book_id, book_format.lower()) return get_download_link(book_id, book_format.lower())
...@@ -1105,9 +1105,9 @@ def send_to_kindle(book_id, book_format, convert): ...@@ -1105,9 +1105,9 @@ def send_to_kindle(book_id, book_format, convert):
category="success") category="success")
ub.update_download(book_id, int(current_user.id)) ub.update_download(book_id, int(current_user.id))
else: else:
flash(_(u"There was an error sending this book: %(res)s", res=result), category="error") flash(_(u"Oops! There was an error sending this book: %(res)s", res=result), category="error")
else: else:
flash(_(u"Please configure your kindle e-mail address first..."), category="error") flash(_(u"Please update your profile with a valid Send to Kindle E-mail Address."), category="error")
if "HTTP_REFERER" in request.environ: if "HTTP_REFERER" in request.environ:
return redirect(request.environ["HTTP_REFERER"]) return redirect(request.environ["HTTP_REFERER"])
else: else:
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment