plugins import, tickets import, bugzilla import: comments handling:
- comments are put in "comments" key in import data, it's a list of microblog data - in resulting item, the comments uri is put in comments_uri field - (plugin import) root_service and root_node are kept in session - (plugin ticket) reporter name is now in "reporter" key instead of "reporter_name" - (plugin bugizlla): if not reporter name is found, first part of email address is used
This commit is contained in:
parent
363ee1db88
commit
08a14fa4ac
4 changed files with 50 additions and 19 deletions
|
|
@ -53,8 +53,10 @@ class ImportPlugin(object):
|
|||
@param import_handler(object): specialized import handler instance
|
||||
must have the following methods:
|
||||
- importItem: import a single main item (i.e. prepare data for publishing)
|
||||
- importSubitems: import sub items (i.e. items linked to main item, e.g. comments). Must return a dict with kwargs for recursiveImport if items are to be imported. At east "items_import_data", "service" and "node" keys must be provided.
|
||||
if None is returned, no subitems will be imported
|
||||
- importSubitems: import sub items (i.e. items linked to main item, e.g. comments).
|
||||
Must return a dict with kwargs for recursiveImport if items are to be imported recursively.
|
||||
At least "items_import_data", "service" and "node" keys must be provided.
|
||||
if None is returned, no recursion will be done to import subitems, but import can still be done directly by the method.
|
||||
- publishItem: actualy publish an item
|
||||
- itemFilters: modify item according to options
|
||||
@param name(unicode): import handler name
|
||||
|
|
@ -139,6 +141,7 @@ class ImportPlugin(object):
|
|||
else:
|
||||
if not value:
|
||||
del options[opt_name]
|
||||
|
||||
try:
|
||||
importer = import_handler.importers[name]
|
||||
except KeyError:
|
||||
|
|
@ -159,7 +162,10 @@ class ImportPlugin(object):
|
|||
}
|
||||
self.host.registerProgressCb(progress_id, partial(self.getProgress, import_handler), metadata, profile=client.profile)
|
||||
self.host.bridge.progressStarted(progress_id, metadata, client.profile)
|
||||
session = {} # session data, can be use by importers
|
||||
session = { # session data, can be used by importers
|
||||
u'root_service': pubsub_service,
|
||||
u'root_node': pubsub_node
|
||||
}
|
||||
self.recursiveImport(client, import_handler, items_import_data, progress_id, session, options, None, pubsub_service, pubsub_node)
|
||||
defer.returnValue(progress_id)
|
||||
|
||||
|
|
@ -172,6 +178,7 @@ class ImportPlugin(object):
|
|||
@param progress_id(unicode): id of progression
|
||||
@param session(dict): data for this import session
|
||||
can be used by importer so store any useful data
|
||||
"root_service" and "root_node" are set to the main pubsub service and node of the import
|
||||
@param options(dict): import options
|
||||
@param return_data(dict): data to return on progressFinished
|
||||
@param service(jid.JID, None): PubSub service to use
|
||||
|
|
|
|||
Loading…
Reference in a new issue