Fix lcase function

pull/1429/head
OzzieIsaacs 4 years ago
parent b1b293a3ec
commit d0e15da352

@ -546,14 +546,14 @@ class CalibreDB(threading.Thread):
def get_typeahead(self, database, query, replace=('', ''), tag_filter=true()):
query = query or ''
self.session.connection().connection.connection.create_function("lower", 1, self.lcase)
self.session.connection().connection.connection.create_function("lower", 1, lcase)
entries = self.session.query(database).filter(tag_filter). \
filter(func.lower(database.name).ilike("%" + query + "%")).all()
json_dumps = json.dumps([dict(name=r.name.replace(*replace)) for r in entries])
return json_dumps
def check_exists_book(self, authr, title):
self.session.connection().connection.connection.create_function("lower", 1, self.lcase)
self.session.connection().connection.connection.create_function("lower", 1, lcase)
q = list()
authorterms = re.split(r'\s*&\s*', authr)
for authorterm in authorterms:
@ -565,7 +565,7 @@ class CalibreDB(threading.Thread):
# read search results from calibre-database and return it (function is used for feed and simple search
def get_search_results(self, term):
term.strip().lower()
self.session.connection().connection.connection.create_function("lower", 1, self.lcase)
self.session.connection().connection.connection.create_function("lower", 1, lcase)
q = list()
authorterms = re.split("[, ]+", term)
for authorterm in authorterms:
@ -642,8 +642,10 @@ class CalibreDB(threading.Thread):
self.engine.dispose()
self.setup_db(config, app_db_path)
def lcase(self, s):
try:
return unidecode.unidecode(s.lower())
except Exception as e:
self.log.exception(e)
def lcase(s):
try:
return unidecode.unidecode(s.lower())
except Exception as e:
log = logger.create()
log.exception(e)
return s.lower()

@ -590,7 +590,7 @@ def get_languages_json():
def get_matching_tags():
tag_dict = {'tags': []}
q = calibre_db.session.query(db.Books)
calibre_db.session.connection().connection.connection.create_function("lower", 1, calibre_db.lcase)
calibre_db.session.connection().connection.connection.create_function("lower", 1, db.lcase)
author_input = request.args.get('author_name') or ''
title_input = request.args.get('book_title') or ''
include_tag_inputs = request.args.getlist('include_tag') or ''
@ -1020,7 +1020,7 @@ def search():
def advanced_search():
# Build custom columns names
cc = get_cc_columns()
calibre_db.session.connection().connection.connection.create_function("lower", 1, calibre_db.lcase)
calibre_db.session.connection().connection.connection.create_function("lower", 1, db.lcase)
q = calibre_db.session.query(db.Books).filter(calibre_db.common_filters()).order_by(db.Books.sort)
include_tag_inputs = request.args.getlist('include_tag')

@ -36,17 +36,17 @@
<div class="col-xs-12 col-sm-6">
<div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
<p class='text-justify attribute'><strong>Start Time: </strong>2020-05-22 07:43:12</p>
<p class='text-justify attribute'><strong>Start Time: </strong>2020-05-22 18:17:02</p>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Stop Time: </strong>2020-05-22 08:41:06</p>
<p class='text-justify attribute'><strong>Stop Time: </strong>2020-05-22 19:14:53</p>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Duration: </strong>48:51 min</p>
<p class='text-justify attribute'><strong>Duration: </strong>48:49 min</p>
</div>
</div>
</div>
@ -2219,8 +2219,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr class="result['header']['style']">
<td>test_visiblilitys.calibre_web_visibilitys</td>
<td class="text-center">28</td>
<td class="text-center">27</td>
<td class="text-center">1</td>
<td class="text-center">28</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center">
@ -2410,31 +2410,11 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr id='ft20.21' class='none bg-danger'>
<tr id='pt20.21' class='hiddenRow bg-success'>
<td>
<div class='testcase'>test_link_column_to_read_status</div>
</td>
<td colspan='6'>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft20.21')">FAIL</a>
</div>
<!--css div popup start-->
<div id='div_ft20.21' class="popup_window test_output" style="display:none;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus='this.blur();'
onclick="document.getElementById('div_ft20.21').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_visiblilitys.py", line 683, in test_link_column_to_read_status
self.assertEqual(len(details['cust_columns']), 0)
AssertionError: 1 != 0</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
<td colspan='6' align='center'>PASS</td>
</tr>
@ -2505,8 +2485,8 @@ AssertionError: 1 != 0</pre>
<tr id='total_row' class="text-center bg-grey">
<td>Total</td>
<td>211</td>
<td>200</td>
<td>5</td>
<td>201</td>
<td>4</td>
<td>0</td>
<td>6</td>
<td>&nbsp;</td>
@ -2734,7 +2714,7 @@ AssertionError: 1 != 0</pre>
</div>
<script>
drawCircle(200, 5, 0, 6);
drawCircle(201, 4, 0, 6);
</script>
</div>

Loading…
Cancel
Save