Skip to content

Commit cc35779

Browse files
committed
Bugfix in opening multiple databases
1 parent d9bc589 commit cc35779

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

keepmenu/keepmenu.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ def __init__(self, server, **kwargs):
299299
keepmenu.reload_config(None if cfile is None else expanduser(cfile))
300300
self.server = server
301301
self.database, self.open_databases = get_database(**kwargs)
302-
#if self.database:
303-
# self.database.kpo = get_entries(self.database)
304302
if not self.database or not self.database.kpo:
305303
self.server.kill_flag.set()
306304
sys.exit()
@@ -495,17 +493,13 @@ def menu_open_another_database(self, **kwargs):
495493
Args: kwargs - possibly 'database', 'keyfile', 'autotype', 'totp'
496494
497495
"""
498-
prev_db, prev_open = self.database, copy(self.open_databases)
496+
prev_db = copy(self.database)
499497
self.database, self.open_databases = get_database(self.open_databases, **kwargs)
500-
if self.database is None:
501-
self.database, self.open_databases = prev_db, prev_open
498+
if self.database is None or self.database.kpo is None:
499+
self.database = copy(prev_db)
500+
_ = self.open_databases.popitem()
501+
self.open_databases[self.database.dbase].is_active = True
502502
return
503-
if not self.database.kpo:
504-
print("get_entries")
505-
self.database.kpo = get_entries(self.database)
506-
if self.database.kpo is None:
507-
self.database, self.open_databases = prev_db, prev_open
508-
return
509503
self.expiring = get_expiring_entries(self.database.kpo.entries)
510504
self.dmenu_run(self.database.totp)
511505

0 commit comments

Comments
 (0)