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" install: "pip install -r requirements.txt"
script: script:
- python3 -m flake8 - 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 - python3 -m pytest ./tests/test_*.py --cov buku -vv
before_deploy: before_deploy:
- sudo apt-get update -qy - sudo apt-get update -qy

25
buku.py
View File

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