Fix build break

This commit is contained in:
Arun Prakash Jana 2021-05-01 19:44:08 +05:30
parent f664e1d319
commit 58adeb78bf
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 24 additions and 26 deletions

39
buku
View File

@ -2219,28 +2219,23 @@ class BukuDb:
print('%s exported' % count)
return True
try:
outfp = open(filepath, mode='w', encoding='utf-8')
except Exception as e:
LOGERR(e)
return False
res = {} # type: Dict
if filepath.endswith('.md'):
res = convert_bookmark_set(resultset, 'markdown')
count += res['count']
outfp.write(res['data'])
elif filepath.endswith('.org'):
res = convert_bookmark_set(resultset, 'org')
count += res['count']
outfp.write(res['data'])
else:
res = convert_bookmark_set(resultset, 'html')
count += res['count']
outfp.write(res['data'])
outfp.close()
print('%s exported' % count)
return True
with open(filepath, mode='w', encoding='utf-8') as outfp:
res = {} # type: Dict
if filepath.endswith('.md'):
res = convert_bookmark_set(resultset, 'markdown')
count += res['count']
outfp.write(res['data'])
elif filepath.endswith('.org'):
res = convert_bookmark_set(resultset, 'org')
count += res['count']
outfp.write(res['data'])
else:
res = convert_bookmark_set(resultset, 'html')
count += res['count']
outfp.write(res['data'])
print('%s exported' % count)
return True
return False
def traverse_bm_folder(self, sublist, unique_tag, folder_name, add_parent_folder_as_tag):
"""Traverse bookmark folders recursively and find bookmarks.

View File

@ -31,8 +31,11 @@ logging.basicConfig() # you need to initialize logging, otherwise you will not
vcr_log = logging.getLogger("vcr")
vcr_log.setLevel(logging.INFO)
TEST_TEMP_DIR_OBJ = TemporaryDirectory(prefix="bukutest_")
TEST_TEMP_DIR_PATH = TEST_TEMP_DIR_OBJ.name
def get_temp_dir_path():
with TemporaryDirectory(prefix="bukutest_") as dir_obj:
return dir_obj
TEST_TEMP_DIR_PATH = get_temp_dir_path()
TEST_TEMP_DBDIR_PATH = os.path.join(TEST_TEMP_DIR_PATH, "buku")
TEST_TEMP_DBFILE_PATH = os.path.join(TEST_TEMP_DBDIR_PATH, "bookmarks.db")
MAX_SQLITE_INT = int(math.pow(2, 63) - 1)
@ -1311,8 +1314,8 @@ def firefox_db(tmpdir):
tmp_zip.strpath, "wb"
) as out_file:
shutil.copyfileobj(response, out_file)
zip_obj = zipfile.ZipFile(tmp_zip.strpath)
zip_obj.extractall(path=os.path.join(dir_path, "test_bukuDb"))
with zipfile.ZipFile(tmp_zip.strpath) as zip_obj:
zip_obj.extractall(path=os.path.join(dir_path, "test_bukuDb"))
return ff_db_path, res_yaml_file, res_nopt_yaml_file