From 7b01c62e07612a123f3ffe94583f51099e470c3b Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 20 Oct 2014 20:03:16 +0200 Subject: Change the API of Config.get_by_tabname Make the "default" parameter optional and thus move it to the end of the command with the other optional parameters. And change all the calls. --- src/bookmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bookmark.py') diff --git a/src/bookmark.py b/src/bookmark.py index aa710d24..1807c45e 100644 --- a/src/bookmark.py +++ b/src/bookmark.py @@ -226,7 +226,7 @@ def get_local(): nick = jid.resource else: nick = None - passwd = config.get_by_tabname('password', '', jid.bare, fallback=False) or None + passwd = config.get_by_tabname('password', jid.bare, fallback=False) or None b = Bookmark(jid.bare, autojoin=True, nick=nick, password=passwd, method='local') if not get_by_jid(b.jid): bookmarks.append(b) -- cgit v1.2.3 From f9734cde5623aaf701e222b00d5eebdf7a152772 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 20 Oct 2014 21:04:14 +0200 Subject: Remove the (sometimes wrong) default values in the config.get() calls --- src/bookmark.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/bookmark.py') diff --git a/src/bookmark.py b/src/bookmark.py index 1807c45e..672fb4a5 100644 --- a/src/bookmark.py +++ b/src/bookmark.py @@ -23,7 +23,7 @@ def xml_iter(xml, tag=''): else: return xml.getiterator(tag) -preferred = config.get('use_bookmarks_method', 'pep').lower() +preferred = config.get('use_bookmarks_method').lower() if preferred not in ('pep', 'privatexml'): preferred = 'privatexml' not_preferred = 'privatexml' if preferred == 'pep' else 'privatexml' @@ -155,8 +155,8 @@ def save_local(): def save(xmpp, core=None): """Save all the bookmarks.""" save_local() - if config.get('use_remote_bookmarks', True): - preferred = config.get('use_bookmarks_method', 'privatexml') + if config.get('use_remote_bookmarks'): + preferred = config.get('use_bookmarks_method') if not save_remote(xmpp, method=preferred) and core: core.information('Could not save bookmarks.', 'Error') return False @@ -192,7 +192,7 @@ def get_remote(xmpp): """Add the remotely stored bookmarks to the list.""" if xmpp.anon: return - method = config.get('use_bookmarks_method', '') + method = config.get('use_bookmarks_method') if not method: pep, privatexml = True, True for method in methods[1:]: @@ -214,7 +214,7 @@ def get_remote(xmpp): def get_local(): """Add the locally stored bookmarks to the list.""" - rooms = config.get('rooms', '') + rooms = config.get('rooms') if not rooms: return rooms = rooms.split(':') -- cgit v1.2.3