code cosmetics
This commit is contained in:
parent
8c7a8a954a
commit
dc45b53b24
|
@ -366,6 +366,7 @@ class Updater(threading.Thread):
|
|||
def one_minus_two(self, one, two):
|
||||
return [x for x in one if x not in set(two)]
|
||||
|
||||
@classmethod
|
||||
def reduce_dirs(self, delete_files, new_list):
|
||||
new_delete = []
|
||||
for file in delete_files:
|
||||
|
|
|
@ -141,7 +141,7 @@ $(document).ready(function () {
|
|||
function dbSearchBook (title) {
|
||||
var url = douban + dbSearch + "?q=" + title + "&fields=all&count=10";
|
||||
$.ajax({
|
||||
url: url,
|
||||
url,
|
||||
type: "GET",
|
||||
dataType: "jsonp",
|
||||
jsonp: "callback",
|
||||
|
@ -149,7 +149,7 @@ $(document).ready(function () {
|
|||
dbResults = data.books;
|
||||
},
|
||||
error () {
|
||||
$("#meta-info").html('<p class="text-danger">'+ msg.search_error+"!</p>");
|
||||
$("#meta-info").html("<p class=\"text-danger\">"+ msg.search_error+"!</p>");
|
||||
},
|
||||
complete () {
|
||||
dbDone = true;
|
||||
|
|
10
cps/web.py
10
cps/web.py
|
@ -484,7 +484,7 @@ def fill_indexpage(page, database, db_filter, order):
|
|||
return entries, random, pagination
|
||||
|
||||
|
||||
def modify_database_object(input_elements, db_book_object, db_object, db_session, type):
|
||||
def modify_database_object(input_elements, db_book_object, db_object, db_session, db_type):
|
||||
input_elements = [x for x in input_elements if x != '']
|
||||
# we have all input element (authors, series, tags) names now
|
||||
# 1. search for elements to remove
|
||||
|
@ -516,7 +516,7 @@ def modify_database_object(input_elements, db_book_object, db_object, db_session
|
|||
db_session.delete(del_element)
|
||||
# if there are elements to add, we add them now!
|
||||
if len(add_elements) > 0:
|
||||
if type == 'languages':
|
||||
if db_type == 'languages':
|
||||
db_filter = db_object.lang_code
|
||||
else:
|
||||
db_filter = db_object.name
|
||||
|
@ -525,12 +525,12 @@ def modify_database_object(input_elements, db_book_object, db_object, db_session
|
|||
new_element = db_session.query(db_object).filter(db_filter == add_element).first()
|
||||
# if no element is found add it
|
||||
if new_element is None:
|
||||
if type == 'author':
|
||||
if db_type == 'author':
|
||||
new_element = db_object(add_element, add_element, "")
|
||||
else:
|
||||
if type == 'series':
|
||||
if db_type == 'series':
|
||||
new_element = db_object(add_element, add_element)
|
||||
else: # type should be tag, or languages
|
||||
else: # db_type should be tag, or languages
|
||||
new_element = db_object(add_element)
|
||||
db_session.add(new_element)
|
||||
new_element = db.session.query(db_object).filter(db_filter == add_element).first()
|
||||
|
|
Loading…
Reference in New Issue
Block a user