# HG changeset patch # User Goffi # Date 1510813860 -3600 # Node ID 91bbad17fd534ba3cdd730815fcceb500e76ca36 # Parent b52e78cc86edcdc70a9cd6bfecbf70451bbf15a9 plugins blog import, tickets import, XEP-0277: fixed call to getCommentsService (it is now returning a Deferred) diff -r b52e78cc86ed -r 91bbad17fd53 src/plugins/plugin_blog_import.py --- a/src/plugins/plugin_blog_import.py Wed Nov 15 21:15:42 2017 +0100 +++ b/src/plugins/plugin_blog_import.py Thu Nov 16 07:31:00 2017 +0100 @@ -121,24 +121,26 @@ return mb_data + @defer.inlineCallbacks def importSubItems(self, client, item_import_data, mb_data, session, options): # comments data if len(item_import_data['comments']) != 1: raise NotImplementedError(u"can't manage multiple comment links") allow_comments = C.bool(mb_data.get('allow_comments', C.BOOL_FALSE)) if allow_comments: - comments_service, comments_node = self._m.getCommentsService(client), self._m.getCommentsNode(mb_data['id']) + comments_service = yield self._m.getCommentsService(client) + comments_node = self._m.getCommentsNode(mb_data['id']) mb_data['comments_service'] = comments_service.full() mb_data['comments_node'] = comments_node recurse_kwargs = { 'items_import_data':item_import_data['comments'][0], 'service':comments_service, 'node':comments_node} - return recurse_kwargs + defer.returnValue(recurse_kwargs) else: if item_import_data['comments'][0]: raise exceptions.DataError(u"allow_comments set to False, but comments are there") - return None + defer.returnValue(None) def publishItem(self, client, mb_data, service, node, session): log.debug(u"uploading item [{id}]: {title}".format(id=mb_data['id'], title=mb_data.get('title',''))) diff -r b52e78cc86ed -r 91bbad17fd53 src/plugins/plugin_tickets_import.py --- a/src/plugins/plugin_tickets_import.py Wed Nov 15 21:15:42 2017 +0100 +++ b/src/plugins/plugin_tickets_import.py Thu Nov 16 07:31:00 2017 +0100 @@ -123,7 +123,8 @@ # TODO: handle "private" metadata, to have non public access for node # TODO: node access/publish model should be customisable comments = ticket_data.get('comments', []) - service, node = self._m.getCommentsService(client), self._m.getCommentsNode(session['root_node'] + u'_' + ticket_data['id']) + service = yield self._m.getCommentsService(client) + node = self._m.getCommentsNode(session['root_node'] + u'_' + ticket_data['id']) node_options = {self._p.OPT_ACCESS_MODEL: self._p.ACCESS_OPEN, self._p.OPT_PERSIST_ITEMS: 1, self._p.OPT_MAX_ITEMS: -1, diff -r b52e78cc86ed -r 91bbad17fd53 src/plugins/plugin_xep_0277.py --- a/src/plugins/plugin_xep_0277.py Wed Nov 15 21:15:42 2017 +0100 +++ b/src/plugins/plugin_xep_0277.py Thu Nov 16 07:31:00 2017 +0100 @@ -541,7 +541,7 @@ try: comments_service = jid.JID(mb_data['comments_service']) except KeyError: - comments_service = self.getCommentsService(client, service) + comments_service = yield self.getCommentsService(client, service) try: yield self._p.createNode(client, comments_service, comments_node, options)