diff --git a/HISTORY.rst b/HISTORY.rst index 6ba262ca07..dbc3e76de1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,6 +12,8 @@ Importer branch ================== * Add support for disabling the random primary key test mixin. +* Add a reusable task to upload documents. +* Add MVP of the importer app. * Fix mailing profile log columns mappings. GitLab issue #626. Thanks to Jesaja Everling (@jeverling) for the report. @@ -21,7 +23,6 @@ Importer branch * Increase the Django STMP username. GitLab issue #625. Thanks to Jesaja Everling (@jeverling) for the report and the research. ->>>>>>> versions/minor 3.2.2 (2019-06-19) ================== diff --git a/docs/releases/3.2.3.rst b/docs/releases/3.2.3.rst index 0cb49a1cd8..9e0025e72d 100644 --- a/docs/releases/3.2.3.rst +++ b/docs/releases/3.2.3.rst @@ -19,7 +19,6 @@ Changes GitLab issue #625. Thanks to Jesaja Everling (@jeverling) for the report and the research. - Removals -------- @@ -107,12 +106,8 @@ Backward incompatible changes Bugs fixed or issues closed --------------------------- -<<<<<<< HEAD -- :gitlab-issue:`615` -======= - :gitlab-issue:`619` poplib.POP3_SSL and poplib.POP3 initialized with wrong kwarg - :gitlab-issue:`625` mayan.apps.mailer.mailers.DjangoSMTP uses "user", but django.core.mail.backends.smtp.EmailBackend expects "username" - :gitlab-issue:`626` Mailing profile error log is empty, despite errors ->>>>>>> versions/minor .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/importer/tasks.py b/mayan/apps/importer/tasks.py index ccdf24c867..7157a9a57f 100644 --- a/mayan/apps/importer/tasks.py +++ b/mayan/apps/importer/tasks.py @@ -65,13 +65,20 @@ def task_upload_new_document(self, document_type_id, shared_uploaded_file_id, ex if extra_data: for pair in extra_data.get('metadata_pairs', []): name = slugify(pair['name']).replace('-', '_') + logger.debug( + 'Metadata pair (label, name, value): %s, %s, %s', + pair['name'], name, pair['value'] + ) + metadata_type, created = MetadataType.objects.get_or_create( label=pair['name'], defaults={'name': name} ) - if created: + if not new_document.document_type.metadata.filter(metadata_type=metadata_type).exists(): + logger.debug('Metadata type created') new_document.document_type.metadata.create( metadata_type=metadata_type, required=False ) + new_document.metadata.create( metadata_type=metadata_type, value=pair['value'] )