# HG changeset patch # User Goffi # Date 1570529053 -7200 # Node ID 412d26a9b2c2363c88d8ab0f0b65972f3eda345a # Parent ee722faa3e93bef85b426cba17a00ac5dfa10d0e import sat/wokkel modules only when making service: when importing some sat/wokkel module, a reactor is installed. This can cause trouble when using sat_pubsub along with other twisted plugin installing a specific reactor (which is the case for SàT backend and Libervia). This patch works around it by importing those modules only when making the service. diff -r ee722faa3e93 -r 412d26a9b2c2 sat_pubsub/pubsub_admin.py --- a/sat_pubsub/pubsub_admin.py Sun Aug 25 12:26:35 2019 +0200 +++ b/sat_pubsub/pubsub_admin.py Tue Oct 08 12:04:13 2019 +0200 @@ -110,7 +110,6 @@ pep=pep, recipient=recipient) except (error.Forbidden, error.ItemForbidden): - __import__('pudb').set_trace() self.sendError(iq_elt, "forbidden") return except Exception as e: diff -r ee722faa3e93 -r 412d26a9b2c2 twisted/plugins/pubsub.py --- a/twisted/plugins/pubsub.py Sun Aug 25 12:26:35 2019 +0200 +++ b/twisted/plugins/pubsub.py Tue Oct 08 12:04:13 2019 +0200 @@ -59,23 +59,8 @@ from twisted.words.protocols.jabber.jid import JID from twisted.plugin import IPlugin -from wokkel.component import Component -from wokkel.disco import DiscoHandler -from wokkel.generic import FallbackHandler, VersionHandler -from wokkel.iwokkel import IPubSubResource -from wokkel import data_form -from wokkel import pubsub -from wokkel import rsm -from wokkel import mam from zope.interface import implementer -from sat_pubsub import const -from sat_pubsub import mam as pubsub_mam -from sat_pubsub import pubsub_admin -from sat_pubsub.backend import BackendService, ExtraDiscoHandler -from sat_pubsub.schema import SchemaHandler -from sat_pubsub.privilege import PrivilegesHandler -from sat_pubsub.delegation import DelegationsHandler from os.path import expanduser, realpath import configparser @@ -178,6 +163,22 @@ options = Options def makeService(self, config): + from wokkel.component import Component + from wokkel.disco import DiscoHandler + from wokkel.generic import FallbackHandler, VersionHandler + from wokkel.iwokkel import IPubSubResource + from wokkel import data_form + from wokkel import pubsub + from wokkel import rsm + from wokkel import mam + from sat_pubsub import const + from sat_pubsub import mam as pubsub_mam + from sat_pubsub import pubsub_admin + from sat_pubsub.backend import BackendService, ExtraDiscoHandler + from sat_pubsub.schema import SchemaHandler + from sat_pubsub.privilege import PrivilegesHandler + from sat_pubsub.delegation import DelegationsHandler + if not config['jid'] or not config['xmpp_pwd']: raise usage.UsageError("You must specify jid and xmpp_pwd") s = service.MultiService()