summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-05-07 11:58:19 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-05-07 11:58:19 +0100
commit5b35bde9069bfc0b5cbc34c9430902396794d804 (patch)
tree07785477cf86776911f0208024a9c732f9444f77
parent463ad192be47c9d110a6be3baffdbb181c325db4 (diff)
downloadpoezio-5b35bde9069bfc0b5cbc34c9430902396794d804.tar.gz
poezio-5b35bde9069bfc0b5cbc34c9430902396794d804.tar.bz2
poezio-5b35bde9069bfc0b5cbc34c9430902396794d804.tar.xz
poezio-5b35bde9069bfc0b5cbc34c9430902396794d804.zip
config: ensure tabname is not a JID object
Tabnames should be treated as opaque strings. This specific fix prevents tabname (JID) to be compared with invalid stringly-typed JIDs. JID's __eq__ method used to (after poezio/slixmpp@47968963) try and convert anything into JIDs. This has been fixed and now properly returns NotImplemented. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/config.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/poezio/config.py b/poezio/config.py
index c87f881a..acd5f293 100644
--- a/poezio/config.py
+++ b/poezio/config.py
@@ -20,6 +20,7 @@ from configparser import RawConfigParser, NoOptionError, NoSectionError
from pathlib import Path
from shutil import copy2
from typing import Callable, Dict, List, Optional, Union, Tuple
+from slixmpp import JID
from poezio.args import parse_args
from poezio import xdg
@@ -214,7 +215,7 @@ class Config(RawConfigParser):
def get_by_tabname(self,
option,
- tabname,
+ tabname: str,
fallback=True,
fallback_server=True,
default=''):
@@ -224,6 +225,8 @@ class Config(RawConfigParser):
in the section, we search for the global option if fallback is
True. And we return `default` as a fallback as a last resort.
"""
+ if isinstance(tabname, JID):
+ tabname = tabname.full
if self.default and (not default) and fallback:
default = self.default.get(DEFSECTION, {}).get(option, '')
if tabname in self.sections():