summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2018-04-26 08:11:38 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2018-04-26 08:11:38 (GMT)
commitdfc266661a7265397507bd3c0e67c8cf50c00781 (patch)
tree9d452efb7ed27421c77f3b17c67ed13662aeea5d
parent85603bbc6e6f3d4d8d898ed909df6afd30586943 (diff)
downloadcollective.dms.batchimport-dfc266661a7265397507bd3c0e67c8cf50c00781.zip
collective.dms.batchimport-dfc266661a7265397507bd3c0e67c8cf50c00781.tar.gz
collective.dms.batchimport-dfc266661a7265397507bd3c0e67c8cf50c00781.tar.bz2
add possibility for predefined keywords (#22009)
-rw-r--r--src/collective/dms/batchimport/fileimporter.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/collective/dms/batchimport/fileimporter.py b/src/collective/dms/batchimport/fileimporter.py
index 6745807..2a62af9 100644
--- a/src/collective/dms/batchimport/fileimporter.py
+++ b/src/collective/dms/batchimport/fileimporter.py
@@ -29,6 +29,7 @@ class IImportFileFormSchema(form.Schema):
location = schema.Text(required=False)
owner = schema.Text(required=False)
treating_group = schema.Text(required=False)
+ keywords = schema.Text(required=False) # comma separated identifiers
class ImportFileForm(form.SchemaForm):
@@ -72,9 +73,13 @@ class ImportFileForm(form.SchemaForm):
owner = data['owner']
treating_group = data['treating_group']
folder = self.get_folder(data['location'])
+ keywords = set([x.strip() for x in data['keywords'].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,
- metadata={'title': data.get('title')})
+ metadata={
+ 'title': data.get('title'),
+ 'keywords': keywords,
+ })