Dont fail if modules are not registered
This is for Zeroconf so we dont have to test in GUI always for account != local Fixes #9229
This commit is contained in:
parent
a4350a812b
commit
42ccbe7499
|
@ -63,6 +63,7 @@ from gajim.common import gpg
|
||||||
from gajim.common import passwords
|
from gajim.common import passwords
|
||||||
from gajim.common import i18n
|
from gajim.common import i18n
|
||||||
from gajim.common import idle
|
from gajim.common import idle
|
||||||
|
from gajim.common.helpers import ModuleMock
|
||||||
from gajim.common.modules.entity_time import EntityTime
|
from gajim.common.modules.entity_time import EntityTime
|
||||||
from gajim.common.modules.software_version import SoftwareVersion
|
from gajim.common.modules.software_version import SoftwareVersion
|
||||||
from gajim.common.modules.ping import Ping
|
from gajim.common.modules.ping import Ping
|
||||||
|
@ -179,7 +180,10 @@ class CommonConnection:
|
||||||
app.ged.raise_event(event, self.name, data)
|
app.ged.raise_event(event, self.name, data)
|
||||||
|
|
||||||
def get_module(self, name):
|
def get_module(self, name):
|
||||||
return self._modules[name]
|
try:
|
||||||
|
return self._modules[name]
|
||||||
|
except KeyError:
|
||||||
|
return ModuleMock()
|
||||||
|
|
||||||
def get_module_handlers(self):
|
def get_module_handlers(self):
|
||||||
handlers = []
|
handlers = []
|
||||||
|
|
|
@ -164,6 +164,14 @@ class LocalTimezone(tzinfo):
|
||||||
class InvalidFormat(Exception):
|
class InvalidFormat(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ModuleMock:
|
||||||
|
def __getattr__(self, key):
|
||||||
|
def _mock(self, *args, **kwargs):
|
||||||
|
return
|
||||||
|
return _mock
|
||||||
|
|
||||||
|
|
||||||
def decompose_jid(jidstring):
|
def decompose_jid(jidstring):
|
||||||
user = None
|
user = None
|
||||||
server = None
|
server = None
|
||||||
|
|
Loading…
Reference in New Issue