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) print('%s exported' % count)
return True return True
try: with open(filepath, mode='w', encoding='utf-8') as outfp:
outfp = open(filepath, mode='w', encoding='utf-8') res = {} # type: Dict
except Exception as e: if filepath.endswith('.md'):
LOGERR(e) res = convert_bookmark_set(resultset, 'markdown')
return False count += res['count']
outfp.write(res['data'])
res = {} # type: Dict elif filepath.endswith('.org'):
if filepath.endswith('.md'): res = convert_bookmark_set(resultset, 'org')
res = convert_bookmark_set(resultset, 'markdown') count += res['count']
count += res['count'] outfp.write(res['data'])
outfp.write(res['data']) else:
elif filepath.endswith('.org'): res = convert_bookmark_set(resultset, 'html')
res = convert_bookmark_set(resultset, 'org') count += res['count']
count += res['count'] outfp.write(res['data'])
outfp.write(res['data']) print('%s exported' % count)
else: return True
res = convert_bookmark_set(resultset, 'html') return False
count += res['count']
outfp.write(res['data'])
outfp.close()
print('%s exported' % count)
return True
def traverse_bm_folder(self, sublist, unique_tag, folder_name, add_parent_folder_as_tag): def traverse_bm_folder(self, sublist, unique_tag, folder_name, add_parent_folder_as_tag):
"""Traverse bookmark folders recursively and find bookmarks. """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 = logging.getLogger("vcr")
vcr_log.setLevel(logging.INFO) vcr_log.setLevel(logging.INFO)
TEST_TEMP_DIR_OBJ = TemporaryDirectory(prefix="bukutest_") def get_temp_dir_path():
TEST_TEMP_DIR_PATH = TEST_TEMP_DIR_OBJ.name 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_DBDIR_PATH = os.path.join(TEST_TEMP_DIR_PATH, "buku")
TEST_TEMP_DBFILE_PATH = os.path.join(TEST_TEMP_DBDIR_PATH, "bookmarks.db") TEST_TEMP_DBFILE_PATH = os.path.join(TEST_TEMP_DBDIR_PATH, "bookmarks.db")
MAX_SQLITE_INT = int(math.pow(2, 63) - 1) MAX_SQLITE_INT = int(math.pow(2, 63) - 1)
@ -1311,8 +1314,8 @@ def firefox_db(tmpdir):
tmp_zip.strpath, "wb" tmp_zip.strpath, "wb"
) as out_file: ) as out_file:
shutil.copyfileobj(response, out_file) shutil.copyfileobj(response, out_file)
zip_obj = zipfile.ZipFile(tmp_zip.strpath) with zipfile.ZipFile(tmp_zip.strpath) as zip_obj:
zip_obj.extractall(path=os.path.join(dir_path, "test_bukuDb")) zip_obj.extractall(path=os.path.join(dir_path, "test_bukuDb"))
return ff_db_path, res_yaml_file, res_nopt_yaml_file return ff_db_path, res_yaml_file, res_nopt_yaml_file