Fix build break

This commit is contained in:
Arun Prakash Jana 2017-12-26 20:47:43 +05:30
parent 7340065bfe
commit d6c2ddb683
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 19 additions and 8 deletions

View File

@ -14,7 +14,7 @@ before_install:
install: "pip install -r requirements.txt"
script:
- python3 -m flake8
- find . -iname "*.py" | xargs pylint --rcfile tests/.pylintrc
- find . -iname "*.py" ! -path "./api/*" | xargs pylint --rcfile tests/.pylintrc
- python3 -m pytest ./tests/test_*.py --cov buku -vv
before_deploy:
- sudo apt-get update -qy

25
buku.py
View File

@ -1198,7 +1198,7 @@ class BukuDb:
# do not allow combination of search logics
if ' + ' in tags and ',' in tags:
logerr("Cannot use both '+' and ',' in same search")
return
return None
tags, search_operator, excluded_tags = prep_tag_search(tags)
@ -1421,6 +1421,11 @@ class BukuDb:
A range is passed using low and high arguments.
An index is ignored if is_range is True (use dummy index).
Default is False.
Returns
-------
bool
True on success, False on failure.
"""
if (index < 0):
@ -1452,7 +1457,7 @@ class BukuDb:
resultset = self.cur.execute(query, (low, high))
except IndexError:
logerr('Index out of range')
return
return False
elif index != 0: # Show record at index
try:
query = 'SELECT * FROM bookmarks WHERE id = ? LIMIT 1'
@ -1460,30 +1465,32 @@ class BukuDb:
results = self.cur.fetchall()
if not results:
logerr('No matching index %d', index)
return
return False
except IndexError:
logerr('No matching index %d', index)
return
return False
if not self.json:
print_rec_with_filter(results, self.field_filter)
else:
print(format_json(results, True, self.field_filter))
return
return True
else: # Show all entries
self.cur.execute('SELECT * FROM bookmarks')
resultset = self.cur.fetchall()
if not resultset:
logerr('0 records')
return
return True
if not self.json:
print_rec_with_filter(resultset, self.field_filter)
else:
print(format_json(resultset, field_filter=self.field_filter))
return True
def get_tag_all(self):
"""Get list of tags in DB.
@ -2981,6 +2988,8 @@ def edit_at_prompt(obj, nav, suggest=False):
tags = obj.suggest_similar_tag(tags)
obj.add_rec(url, title, tags, desc)
return
def taglist_subprompt(obj, noninteractive=False):
"""Additional prompt to show unique tag list.
@ -3014,7 +3023,7 @@ def taglist_subprompt(obj, noninteractive=False):
print()
if noninteractive:
return
break
try:
nav = read_in(promptmsg)
@ -3043,6 +3052,8 @@ def taglist_subprompt(obj, noninteractive=False):
print('Invalid input')
new_results = False
return ''
def prompt(obj, results, noninteractive=False, deep=False, subprompt=False, suggest=False):
"""Show each matching result from a search and prompt.