plugins blog import, tickets import, XEP-0277: fixed call to getCommentsService (it is now returning a Deferred)

This commit is contained in:
Goffi 2017-11-16 07:31:00 +01:00
commit a014e6a873

View file

@ -121,24 +121,26 @@ class BlogImportPlugin(object):
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','')))