Mercurial > libervia-backend
diff src/plugins/plugin_import.py @ 2396:66baa687c682
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
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Oct 2017 17:58:05 +0200 |
parents | f57a8eaec8ed |
children | 8b37a62336c3 |
line wrap: on
line diff
--- a/src/plugins/plugin_import.py Fri Oct 27 17:54:00 2017 +0200 +++ b/src/plugins/plugin_import.py Fri Oct 27 17:58:05 2017 +0200 @@ -26,6 +26,7 @@ from functools import partial import collections import uuid +import json PLUGIN_INFO = { @@ -110,6 +111,11 @@ 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