diff src/plugins/plugin_import.py @ 2436:b52e78cc86ed

plugin import: fixed deserialisation of pubsub service
author Goffi <goffi@goffi.org>
date Wed, 15 Nov 2017 21:15:42 +0100
parents 8b37a62336c3
children 0046283a285d
line wrap: on
line diff
--- a/src/plugins/plugin_import.py	Wed Nov 15 08:58:56 2017 +0100
+++ b/src/plugins/plugin_import.py	Wed Nov 15 21:15:42 2017 +0100
@@ -23,6 +23,7 @@
 log = getLogger(__name__)
 from twisted.internet import defer
 from sat.core import exceptions
+from twisted.words.protocols.jabber import jid
 from functools import partial
 import collections
 import uuid
@@ -116,7 +117,8 @@
                 options[option] = json.loads(options[option])
             except ValueError:
                 raise exceptions.DataError(_(u'invalid json option: {name}').format(name=option))
-        return self.doImport(client, import_handler, unicode(name), unicode(location), options, pubsub_service or None, pubsub_node or None)
+        pubsub_service = jid.JID(pubsub_service) if pubsub_service else None
+        return self.doImport(client, import_handler, unicode(name), unicode(location), options, pubsub_service, pubsub_node or None)
 
     @defer.inlineCallbacks
     def doImport(self, client, import_handler, name, location, options=None, pubsub_service=None, pubsub_node=None):