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):
|
def one_minus_two(self, one, two):
|
||||||
return [x for x in one if x not in set(two)]
|
return [x for x in one if x not in set(two)]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
def reduce_dirs(self, delete_files, new_list):
|
def reduce_dirs(self, delete_files, new_list):
|
||||||
new_delete = []
|
new_delete = []
|
||||||
for file in delete_files:
|
for file in delete_files:
|
||||||
|
|
|
@ -141,7 +141,7 @@ $(document).ready(function () {
|
||||||
function dbSearchBook (title) {
|
function dbSearchBook (title) {
|
||||||
var url = douban + dbSearch + "?q=" + title + "&fields=all&count=10";
|
var url = douban + dbSearch + "?q=" + title + "&fields=all&count=10";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: "jsonp",
|
dataType: "jsonp",
|
||||||
jsonp: "callback",
|
jsonp: "callback",
|
||||||
|
@ -149,7 +149,7 @@ $(document).ready(function () {
|
||||||
dbResults = data.books;
|
dbResults = data.books;
|
||||||
},
|
},
|
||||||
error () {
|
error () {
|
||||||
$("#meta-info").html('<p class="text-danger">'+ msg.search_error+"!</p>");
|
$("#meta-info").html("<p class=\"text-danger\">"+ msg.search_error+"!</p>");
|
||||||
},
|
},
|
||||||
complete () {
|
complete () {
|
||||||
dbDone = true;
|
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
|
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 != '']
|
input_elements = [x for x in input_elements if x != '']
|
||||||
# we have all input element (authors, series, tags) names now
|
# we have all input element (authors, series, tags) names now
|
||||||
# 1. search for elements to remove
|
# 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)
|
db_session.delete(del_element)
|
||||||
# if there are elements to add, we add them now!
|
# if there are elements to add, we add them now!
|
||||||
if len(add_elements) > 0:
|
if len(add_elements) > 0:
|
||||||
if type == 'languages':
|
if db_type == 'languages':
|
||||||
db_filter = db_object.lang_code
|
db_filter = db_object.lang_code
|
||||||
else:
|
else:
|
||||||
db_filter = db_object.name
|
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()
|
new_element = db_session.query(db_object).filter(db_filter == add_element).first()
|
||||||
# if no element is found add it
|
# if no element is found add it
|
||||||
if new_element is None:
|
if new_element is None:
|
||||||
if type == 'author':
|
if db_type == 'author':
|
||||||
new_element = db_object(add_element, add_element, "")
|
new_element = db_object(add_element, add_element, "")
|
||||||
else:
|
else:
|
||||||
if type == 'series':
|
if db_type == 'series':
|
||||||
new_element = db_object(add_element, add_element)
|
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)
|
new_element = db_object(add_element)
|
||||||
db_session.add(new_element)
|
db_session.add(new_element)
|
||||||
new_element = db.session.query(db_object).filter(db_filter == add_element).first()
|
new_element = db.session.query(db_object).filter(db_filter == add_element).first()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user