Fixed BUG-121: crashing when cannot find a match when searching
This commit is contained in:
1
BUGs
1
BUGs
@@ -28,5 +28,4 @@ Traceback (most recent call last):
|
|||||||
self.url = pref.orig_url
|
self.url = pref.orig_url
|
||||||
AttributeError: 'NoneType' object has no attribute 'orig_url'
|
AttributeError: 'NoneType' object has no attribute 'orig_url'
|
||||||
|
|
||||||
BUG-121: when search cannot find a match it assumes one and barfs
|
|
||||||
BUG-122: Two versions of Ian and of Micky?
|
BUG-122: Two versions of Ian and of Micky?
|
||||||
|
|||||||
3
files.py
3
files.py
@@ -283,6 +283,9 @@ def GetEntriesInSearchView( OPT ):
|
|||||||
with db.engine.connect() as conn:
|
with db.engine.connect() as conn:
|
||||||
OPT.num_entries = conn.execute( text( num_e_sql ) ).first().count
|
OPT.num_entries = conn.execute( text( num_e_sql ) ).first().count
|
||||||
|
|
||||||
|
if OPT.num_entries == 0:
|
||||||
|
return []
|
||||||
|
|
||||||
last_entry_sql= f"{sel_no_order} order by {OPT.last_order_raw} limit 1"
|
last_entry_sql= f"{sel_no_order} order by {OPT.last_order_raw} limit 1"
|
||||||
with db.engine.connect() as conn:
|
with db.engine.connect() as conn:
|
||||||
OPT.last_eid = conn.execute( text( last_entry_sql ) ).first().id
|
OPT.last_eid = conn.execute( text( last_entry_sql ) ).first().id
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="sm-txt my-auto"> {{OPT.how_many}} files </span>
|
<span class="sm-txt my-auto"> {{OPT.how_many}} files </span>
|
||||||
{% set nxt_disabled="" %}
|
{% set nxt_disabled="" %}
|
||||||
{% if entry_data|length < OPT.how_many|int %}
|
{% if entry_data and entry_data|length < OPT.how_many|int %}
|
||||||
{% set nxt_disabled="disabled" %}
|
{% set nxt_disabled="disabled" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<button aria-label="next" id="next" {{nxt_disabled}} name="next" class="next sm-txt btn btn-outline-secondary">
|
<button aria-label="next" id="next" {{nxt_disabled}} name="next" class="next sm-txt btn btn-outline-secondary">
|
||||||
@@ -149,6 +149,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if not entry_data %}
|
||||||
|
<span class="alert alert-danger p-2 col-auto"> No matches for: '{{search_term}}'</span>
|
||||||
|
{% endif %}
|
||||||
{% for obj in entry_data %}
|
{% for obj in entry_data %}
|
||||||
{% if loop.index==1 and OPT.folders %}
|
{% if loop.index==1 and OPT.folders %}
|
||||||
{% if OPT.cwd != OPT.root %}
|
{% if OPT.cwd != OPT.root %}
|
||||||
|
|||||||
Reference in New Issue
Block a user