summaryrefslogtreecommitdiffstats
path: root/src/collective/dms/batchimport/fileimporter.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/collective/dms/batchimport/fileimporter.py')
-rw-r--r--src/collective/dms/batchimport/fileimporter.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/collective/dms/batchimport/fileimporter.py b/src/collective/dms/batchimport/fileimporter.py
index 2201f01..31d3b96 100644
--- a/src/collective/dms/batchimport/fileimporter.py
+++ b/src/collective/dms/batchimport/fileimporter.py
@@ -28,9 +28,12 @@ class IImportFileFormSchema(form.Schema):
portal_type = schema.Text(required=False)
location = schema.Text(required=False)
owner = schema.Text(required=False)
- treating_group = schema.Text(required=False)
+ treating_groups = schema.Text(required=False) # new, comme separated identifiers
keywords = schema.Text(required=False) # comma separated identifiers
+ # legacy
+ treating_group = schema.Text(required=False)
+
class ImportFileForm(form.SchemaForm):
schema = IImportFileFormSchema
@@ -71,14 +74,18 @@ class ImportFileForm(form.SchemaForm):
portal_type = data['portal_type']
filename = data['file'].filename
owner = data['owner']
- treating_group = data['treating_group']
+ if data['treating_group']: # legacy
+ treating_groups = set([data['treating_group']])
+ else:
+ treating_groups = set([x.strip() for x in (data['treating_groups'] or '').split(',')])
+
folder = self.get_folder(data['location'])
keywords = set([x.strip() for x in (data['keywords'] or '').split(',')])
document_id = self.convertTitleToId(data.get('title') or os.path.splitext(filename)[0])
utils.createDocument(self, folder, portal_type, document_id,
- filename, data['file'], owner, treating_group=treating_group,
+ filename, data['file'], owner, treating_groups=treating_groups,
metadata={
'title': data.get('title'),
'keywords': keywords,