Commit 7c6d527a authored by OzzieIsaacs's avatar OzzieIsaacs

Code cosmetics

parent 66181daf
...@@ -22,7 +22,7 @@ except ImportError: ...@@ -22,7 +22,7 @@ except ImportError:
if __name__ == '__main__': if __name__ == '__main__':
if web.ub.DEVELOPMENT: if web.ub.DEVELOPMENT:
web.app.run(host="0.0.0.0", port=web.ub.config.config_port, debug=True) web.app.run(port=web.ub.config.config_port, debug=True)
else: else:
if gevent_present: if gevent_present:
web.app.logger.info('Attempting to start gevent') web.app.logger.info('Attempting to start gevent')
......
...@@ -13,6 +13,7 @@ import os ...@@ -13,6 +13,7 @@ import os
import traceback import traceback
import re import re
import unicodedata import unicodedata
try: try:
from StringIO import StringIO from StringIO import StringIO
from email.MIMEBase import MIMEBase from email.MIMEBase import MIMEBase
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Takes a prefix, query typeahead callback, Bloodhound typeahead adapter Takes a prefix, query typeahead callback, Bloodhound typeahead adapter
and returns the completions it gets from the bloodhound engine prefixed. and returns the completions it gets from the bloodhound engine prefixed.
*/ */
function prefixed_source(prefix, query, cb, bhAdapter) { function prefixedSource(prefix, query, cb, bhAdapter) {
bhAdapter(query, function(retArray){ bhAdapter(query, function(retArray){
var matches = []; var matches = [];
for (var i = 0; i < retArray.length; i++) { for (var i = 0; i < retArray.length; i++) {
...@@ -18,7 +18,7 @@ function prefixed_source(prefix, query, cb, bhAdapter) { ...@@ -18,7 +18,7 @@ function prefixed_source(prefix, query, cb, bhAdapter) {
cb(matches); cb(matches);
}); });
} }
function get_path(){ function getPath(){
var jsFileLocation = $("script[src*=edit_books]").attr("src"); // the js file path var jsFileLocation = $("script[src*=edit_books]").attr("src"); // the js file path
jsFileLocation = jsFileLocation.replace("/static/js/edit_books.js", ''); // the js folder path jsFileLocation = jsFileLocation.replace("/static/js/edit_books.js", ''); // the js folder path
return jsFileLocation; return jsFileLocation;
...@@ -31,7 +31,7 @@ var authors = new Bloodhound({ ...@@ -31,7 +31,7 @@ var authors = new Bloodhound({
}, },
queryTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: { remote: {
url: get_path()+"/get_authors_json?q=%QUERY" url: getPath()+"/get_authors_json?q=%QUERY"
} }
}); });
...@@ -44,7 +44,7 @@ var series = new Bloodhound({ ...@@ -44,7 +44,7 @@ var series = new Bloodhound({
return [query]; return [query];
}, },
remote: { remote: {
url: get_path()+"/get_series_json?q=", url: getPath()+"/get_series_json?q=",
replace: function(url, query) { replace: function(url, query) {
return url+encodeURIComponent(query); return url+encodeURIComponent(query);
} }
...@@ -63,7 +63,7 @@ var tags = new Bloodhound({ ...@@ -63,7 +63,7 @@ var tags = new Bloodhound({
return tokens; return tokens;
}, },
remote: { remote: {
url: get_path()+"/get_tags_json?q=%QUERY" url: getPath()+"/get_tags_json?q=%QUERY"
} }
}); });
...@@ -76,10 +76,9 @@ var languages = new Bloodhound({ ...@@ -76,10 +76,9 @@ var languages = new Bloodhound({
return [query]; return [query];
}, },
remote: { remote: {
url: get_path()+"/get_languages_json?q=", url: getPath()+"/get_languages_json?q=",
replace: function(url, query) { replace: function(url, query) {
url_query = url+encodeURIComponent(query); return url+encodeURIComponent(query);
return url_query;
} }
} }
}); });
...@@ -101,7 +100,7 @@ function sourceSplit(query, cb, split, source) { ...@@ -101,7 +100,7 @@ function sourceSplit(query, cb, split, source) {
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
prefix += tokens[i].trim() + newSplit; prefix += tokens[i].trim() + newSplit;
} }
prefixed_source(prefix, currentSource, cb, bhAdapter); prefixedSource(prefix, currentSource, cb, bhAdapter);
} }
var promiseAuthors = authors.initialize(); var promiseAuthors = authors.initialize();
...@@ -130,7 +129,7 @@ var promiseSeries = series.initialize(); ...@@ -130,7 +129,7 @@ var promiseSeries = series.initialize();
displayKey: "name", displayKey: "name",
source: series.ttAdapter() source: series.ttAdapter()
} }
) );
}); });
var promiseTags = tags.initialize(); var promiseTags = tags.initialize();
...@@ -165,7 +164,7 @@ var promiseLanguages = languages.initialize(); ...@@ -165,7 +164,7 @@ var promiseLanguages = languages.initialize();
$("form").on("change input typeahead:selected", function(data){ $("form").on("change input typeahead:selected", function(data){
var form = $("form").serialize(); var form = $("form").serialize();
$.getJSON( get_path()+"/get_matching_tags", form, function( data ) { $.getJSON( getPath()+"/get_matching_tags", form, function( data ) {
$(".tags_click").each(function() { $(".tags_click").each(function() {
if ($.inArray(parseInt($(this).children("input").first().val(), 10), data.tags) === -1 ) { if ($.inArray(parseInt($(this).children("input").first().val(), 10), data.tags) === -1 ) {
if (!($(this).hasClass("active"))) { if (!($(this).hasClass("active"))) {
......
This diff is collapsed.
...@@ -49,13 +49,13 @@ $(function() { ...@@ -49,13 +49,13 @@ $(function() {
}); });
}); });
$("#check_for_update").click(function() { $("#check_for_update").click(function() {
var button_text = $("#check_for_update").html(); var buttonText = $("#check_for_update").html();
$("#check_for_update").html("..."); $("#check_for_update").html("...");
$.ajax({ $.ajax({
dataType: "json", dataType: "json",
url: window.location.pathname+"/../../get_update_status", url: window.location.pathname+"/../../get_update_status",
success: function(data) { success: function(data) {
$("#check_for_update").html(button_text); $("#check_for_update").html(buttonText);
if (data.status === true) { if (data.status === true) {
$("#check_for_update").addClass("hidden"); $("#check_for_update").addClass("hidden");
$("#perform_update").removeClass("hidden"); $("#perform_update").removeClass("hidden");
...@@ -67,7 +67,7 @@ $(function() { ...@@ -67,7 +67,7 @@ $(function() {
}); });
$("#restart_database").click(function() { $("#restart_database").click(function() {
$.ajax({ $.ajax({
dataType: 'json', dataType: "json",
url: window.location.pathname+"/../../shutdown", url: window.location.pathname+"/../../shutdown",
data: {"parameter":2} data: {"parameter":2}
}); });
...@@ -76,7 +76,7 @@ $(function() { ...@@ -76,7 +76,7 @@ $(function() {
$("#spinner2").show(); $("#spinner2").show();
$.ajax({ $.ajax({
type: "POST", type: "POST",
dataType: 'json', dataType: "json",
data: { start: "True"}, data: { start: "True"},
url: window.location.pathname+"/../../get_updater_status", url: window.location.pathname+"/../../get_updater_status",
success: function(data) { success: function(data) {
...@@ -94,10 +94,10 @@ $(function() { ...@@ -94,10 +94,10 @@ $(function() {
function updateTimer() { function updateTimer() {
$.ajax({ $.ajax({
dataType: 'json', dataType: "json",
url: window.location.pathname+"/../../get_updater_status", url: window.location.pathname+"/../../get_updater_status",
success: function(data) { success: function(data) {
console.log(data.status); // console.log(data.status);
$("#UpdateprogressDialog #Updatecontent").html(updateText[data.status]); $("#UpdateprogressDialog #Updatecontent").html(updateText[data.status]);
if (data.status >6){ if (data.status >6){
clearInterval(updateTimerID); clearInterval(updateTimerID);
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
</div> </div>
<a href="#" id="get_meta" class="btn btn-default" data-toggle="modal" data-target="#metaModal">{{_('Get metadata')}}</a> <a href="#" id="get_meta" class="btn btn-default" data-toggle="modal" data-target="#metaModal">{{_('Get metadata')}}</a>
<button type="submit" class="btn btn-default">{{_('Submit')}}</button> <button type="submit" class="btn btn-default">{{_('Submit')}}</button>
<a href="{{ url_for('show_book',id=book.id) }}" class="btn btn-default">{{_('Back')}}</a> <a href="{{ url_for('show_book', book_id=book.id) }}" class="btn btn-default">{{_('Back')}}</a>
</form> </form>
</div> </div>
{% endif %} {% endif %}
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<h2>{{entry.title}}</h2> <h2>{{entry.title}}</h2>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', id=author.id ) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id ) }}">{{author.name}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
{% endif %} {% endif %}
{% if entry.series|length > 0 %} {% if entry.series|length > 0 %}
<p>{{_('Book')}} {{entry.series_index}} {{_('of')}} <a href="{{url_for('series', id=entry.series[0].id)}}">{{entry.series[0].name}}</a></p> <p>{{_('Book')}} {{entry.series_index}} {{_('of')}} <a href="{{url_for('series', book_id=entry.series[0].id)}}">{{entry.series[0].name}}</a></p>
{% endif %} {% endif %}
{% if entry.languages.__len__() > 0 %} {% if entry.languages.__len__() > 0 %}
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<span class="glyphicon glyphicon-tags"></span> <span class="glyphicon glyphicon-tags"></span>
{% for tag in entry.tags %} {% for tag in entry.tags %}
<a href="{{ url_for('category', id=tag.id) }}" class="btn btn-xs btn-info" role="button">{{tag.name}}</a> <a href="{{ url_for('category', book_id=tag.id) }}" class="btn btn-xs btn-info" role="button">{{tag.name}}</a>
{%endfor%} {%endfor%}
</div> </div>
</p> </p>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
{% if not g.user.is_anonymous() %} {% if not g.user.is_anonymous() %}
<p> <p>
<div class="custom_columns" id="have_read_container"> <div class="custom_columns" id="have_read_container">
<form id="have_read_form" action="{{ url_for('toggle_read', id=entry.id)}}" method="POST") > <form id="have_read_form" action="{{ url_for('toggle_read', book_id=entry.id)}}" method="POST") >
<input id="have_read_cb" type="checkbox" {% if have_read %}checked{% endif %} > <input id="have_read_cb" type="checkbox" {% if have_read %}checked{% endif %} >
<label for="have_read_cb">{{_('Read')}}</label> <label for="have_read_cb">{{_('Read')}}</label>
</form> </form>
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
</button> </button>
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop1"> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1">
{% for format in entry.data %} {% for format in entry.data %}
<li><a href="{{ url_for('get_download_link_ext', book_id=entry.id, format=format.format|lower, anyname=entry.id|string+'.'+format.format) }}">{{format.format}}</a></li> <li><a href="{{ url_for('get_download_link_ext', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format) }}">{{format.format}}</a></li>
{%endfor%} {%endfor%}
</ul> </ul>
</div> </div>
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop2"> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop2">
{% for format in entry.data %} {% for format in entry.data %}
{%if format.format|lower == 'epub' or format.format|lower == 'txt' or format.format|lower == 'pdf' or format.format|lower == 'cbr' or format.format|lower == 'cbt' or format.format|lower == 'cbz' %} {%if format.format|lower == 'epub' or format.format|lower == 'txt' or format.format|lower == 'pdf' or format.format|lower == 'cbr' or format.format|lower == 'cbt' or format.format|lower == 'cbz' %}
<li><a target="_blank" href="{{ url_for('read_book', book_id=entry.id, format=format.format|lower) }}">{{format.format}}</a></li> <li><a target="_blank" href="{{ url_for('read_book', book_id=entry.id, book_format=format.format|lower) }}">{{format.format}}</a></li>
{% endif %} {% endif %}
{%endfor%} {%endfor%}
</ul> </ul>
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
<div class="col-sm-3 col-lg-2 col-xs-6 book"> <div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover"> <div class="cover">
{% if entry.has_cover is defined %} {% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', book_id=entry.id) }}">
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
</a> </a>
{% endif %} {% endif %}
</div> </div>
<div class="meta"> <div class="meta">
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"><a href="{{url_for('author', id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p> <p class="author"><a href="{{url_for('author', book_id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p>
{% if entry.ratings.__len__() > 0 %} {% if entry.ratings.__len__() > 0 %}
<div class="rating"> <div class="rating">
{% for number in range((entry.ratings[0].rating/2)|int(2)) %} {% for number in range((entry.ratings[0].rating/2)|int(2)) %}
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<link type="image/jpeg" href="{{url_for('feed_get_cover', book_id=entry.id)}}" rel="http://opds-spec.org/image/thumbnail"/> <link type="image/jpeg" href="{{url_for('feed_get_cover', book_id=entry.id)}}" rel="http://opds-spec.org/image/thumbnail"/>
{% endif %} {% endif %}
{% for format in entry.data %} {% for format in entry.data %}
<link rel="http://opds-spec.org/acquisition" href="{{ url_for('get_opds_download_link', book_id=entry.id, format=format.format|lower)}}" <link rel="http://opds-spec.org/acquisition" href="{{ url_for('get_opds_download_link', book_id=entry.id, book_format=format.format|lower)}}"
length="{{format.uncompressed_size}}" mtime="{{entry.timestamp}}" type="{{format.format|lower|mimetype}}"/> length="{{format.uncompressed_size}}" mtime="{{entry.timestamp}}" type="{{format.format|lower|mimetype}}"/>
{% endfor %} {% endfor %}
</entry> </entry>
...@@ -65,9 +65,9 @@ ...@@ -65,9 +65,9 @@
{% for entry in listelements %} {% for entry in listelements %}
<entry> <entry>
<title>{{entry.name}}</title> <title>{{entry.name}}</title>
<id>{{ url_for(folder, id=entry.id) }}</id> <id>{{ url_for(folder, book_id=entry.id) }}</id>
<link type="application/atom+xml;profile=opds-catalog;type=feed;kind=acquisition" href="{{url_for(folder, id=entry.id)}}"/> <link type="application/atom+xml;profile=opds-catalog;type=feed;kind=acquisition" href="{{url_for(folder, book_id=entry.id)}}"/>
<link type="application/atom+xml" href="{{url_for(folder, id=entry.id)}}" rel="subsection"/> <link type="application/atom+xml" href="{{url_for(folder, book_id=entry.id)}}" rel="subsection"/>
</entry> </entry>
{% endfor %} {% endfor %}
</feed> </feed>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{% for entry in random %} {% for entry in random %}
<div id="books_rand" class="col-sm-3 col-lg-2 col-xs-6 book"> <div id="books_rand" class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover"> <div class="cover">
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', book_id=entry.id) }}">
{% if entry.has_cover %} {% if entry.has_cover %}
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
{% else %} {% else %}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
<div class="meta"> <div class="meta">
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"><a href="{{url_for('author', id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p> <p class="author"><a href="{{url_for('author', book_id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p>
{% if entry.ratings.__len__() > 0 %} {% if entry.ratings.__len__() > 0 %}
<div class="rating"> <div class="rating">
{% for number in range((entry.ratings[0].rating/2)|int(2)) %} {% for number in range((entry.ratings[0].rating/2)|int(2)) %}
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
{% for entry in entries %} {% for entry in entries %}
<div id="books" class="col-sm-3 col-lg-2 col-xs-6 book"> <div id="books" class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover"> <div class="cover">
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', book_id=entry.id) }}">
{% if entry.has_cover %} {% if entry.has_cover %}
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
{% else %} {% else %}
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', id=author.id) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id) }}">{{author.name}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"timestamp": "{{entry.timestamp}}", "timestamp": "{{entry.timestamp}}",
"thumbnail": "{{url_for('feed_get_cover', book_id=entry.id)}}", "thumbnail": "{{url_for('feed_get_cover', book_id=entry.id)}}",
"main_format": { "main_format": {
"{{entry.data[0].format|lower}}": "{{ url_for('get_opds_download_link', book_id=entry.id, format=entry.data[0].format|lower)}}" "{{entry.data[0].format|lower}}": "{{ url_for('get_opds_download_link', book_id=entry.id, book_format=entry.data[0].format|lower)}}"
}, },
"rating":{% if entry.ratings.__len__() > 0 %} "{{entry.ratings[0].rating}}.0"{% else %}0.0{% endif %}, "rating":{% if entry.ratings.__len__() > 0 %} "{{entry.ratings[0].rating}}.0"{% else %}0.0{% endif %},
"authors": [ "authors": [
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
"other_formats": { "other_formats": {
{% if entry.data.__len__() > 1 %} {% if entry.data.__len__() > 1 %}
{% for format in entry.data[1:] %} {% for format in entry.data[1:] %}
"{{format.format|lower}}": "{{ url_for('get_opds_download_link', book_id=entry.id, format=format.format|lower)}}"{% if not loop.last %},{% endif %} "{{format.format|lower}}": "{{ url_for('get_opds_download_link', book_id=entry.id, book_format=format.format|lower)}}"{% if not loop.last %},{% endif %}
{% endfor %} {% endfor %}
{% endif %} }, {% endif %} },
"title_sort": "{{entry.sort}}" "title_sort": "{{entry.sort}}"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
{% endif %} {% endif %}
<div class="row"> <div class="row">
<div class="col-xs-1" align="left"><span class="badge">{{entry.count}}</span></div> <div class="col-xs-1" align="left"><span class="badge">{{entry.count}}</span></div>
<div class="col-xs-6"><a id="list_{{loop.index0}}" href="{{url_for(folder, id=entry[0].id )}}">{{entry[0].name}}</a></div> <div class="col-xs-6"><a id="list_{{loop.index0}}" href="{{url_for(folder, book_id=entry[0].id )}}">{{entry[0].name}}</a></div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div class="col-sm-3 col-lg-2 col-xs-6 book"> <div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover"> <div class="cover">
{% if entry.has_cover is defined %} {% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', book_id=entry.id) }}">
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
</a> </a>
{% endif %} {% endif %}
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', id=author.id ) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id ) }}">{{author.name}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
<div class="col-sm-3 col-lg-2 col-xs-6 book"> <div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover"> <div class="cover">
{% if entry.has_cover is defined %} {% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', id=entry.id) }}"> <a href="{{ url_for('show_book', book_id=entry.id) }}">
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" /> <img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
</a> </a>
{% endif %} {% endif %}
</div> </div>
<div class="meta"> <div class="meta">
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"><a href="{{url_for('author', id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p> <p class="author"><a href="{{url_for('author', book_id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p>
{% if entry.ratings.__len__() > 0 %} {% if entry.ratings.__len__() > 0 %}
<div class="rating"> <div class="rating">
{% for number in range((entry.ratings[0].rating/2)|int(2)) %} {% for number in range((entry.ratings[0].rating/2)|int(2)) %}
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<h2>{{_('Recent Downloads')}}</h2> <h2>{{_('Recent Downloads')}}</h2>
{% for entry in downloads %} {% for entry in downloads %}
<div class="col-sm-2"> <div class="col-sm-2">
<a class="pull-left" href="{{ url_for('show_book', id=entry.id) }}"> <a class="pull-left" href="{{ url_for('show_book', book_id=entry.id) }}">
<img class="media-object" width="100" src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" alt="..."> <img class="media-object" width="100" src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" alt="...">
</a> </a>
</div> </div>
......
...@@ -93,9 +93,11 @@ class UserBase: ...@@ -93,9 +93,11 @@ class UserBase:
else: else:
return False return False
@staticmethod
def is_active(self): def is_active(self):
return True return True
@staticmethod
def is_anonymous(self): def is_anonymous(self):
return False return False
...@@ -526,7 +528,6 @@ def create_admin_user(): ...@@ -526,7 +528,6 @@ def create_admin_user():
session.commit() session.commit()
except Exception: except Exception:
session.rollback() session.rollback()
pass
# Open session for database connection # Open session for database connection
......
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