plugins tickets import, jp (ticket/import): implemented mapping:

- mapping is an option allowing do map imported field to a specific field in the newly created item
- importers can now use complexe data types in options using JSON
This commit is contained in:
Goffi 2017-10-27 17:58:05 +02:00
commit 55a5b603fd

View file

@ -26,6 +26,7 @@ from sat.core import exceptions
from functools import partial
import collections
import uuid
import json
PLUGIN_INFO = {
@ -110,6 +111,11 @@ class ImportPlugin(object):
options[option] = C.bool(options[option])
except KeyError:
pass
for option in import_handler.JSON_OPTIONS:
try:
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)
@defer.inlineCallbacks