Merge branch 'csllbr-master'

This commit is contained in:
Arun Prakash Jana 2016-09-05 07:38:45 +05:30
commit bebfc965cd

55
buku
View File

@ -1262,42 +1262,37 @@ def prompt(results, noninteractive=False, delete=False):
except EOFError: except EOFError:
return return
if is_int(nav): # iterate over whitespace separated indices
index = int(nav) - 1 for nav in (' '.join(nav.split())).split():
if index < 0 or index >= count: if is_int(nav):
logger.error('Index out of bound') index = int(nav) - 1
continue if index < 0 or index >= count:
logger.error('Index out of bound')
try: continue
browser_open(unquote(results[index][1]))
except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e)
elif nav == 'a':
for index in range(0,count):
try: try:
browser_open(unquote(results[index][1])) browser_open(unquote(results[index][1]))
except Exception as e: except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0] _, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e) logger.error('%s(), ln %d: %s', func, linenumber, e)
elif '-' in nav and is_int(nav.split('-')[0]) and is_int(nav.split('-')[1]): elif '-' in nav and is_int(nav.split('-')[0]) and is_int(nav.split('-')[1]):
lower = int(nav.split('-')[0]) lower = int(nav.split('-')[0])
upper = int(nav.split('-')[1]) upper = int(nav.split('-')[1])
for index in range(lower-1,upper): for index in range(lower-1,upper):
try: try:
browser_open(unquote(results[index][1])) browser_open(unquote(results[index][1]))
except Exception as e: except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0] _, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e) logger.error('%s(), ln %d: %s', func, linenumber, e)
elif ' ' in nav and is_int(nav.split(' ')[0]) and is_int(nav.split(' ')[1]): else:
for index in nav.strip().split(' '): break
try:
browser_open(unquote(results[int(index)-1][1]))
except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e)
else: else:
break if nav == 'a':
for index in range(0, count):
try:
browser_open(unquote(results[index][1]))
except Exception as e:
_, _, linenumber, func, _, _ = inspect.stack()[0]
logger.error('%s(), ln %d: %s', func, linenumber, e)
def print_record(row, count=0): def print_record(row, count=0):