From 2300f4d79367c4fd28b9da2c8042281c38db87a9 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 13:00:24 -0400 Subject: [PATCH 01/20] Install testing dependencies when installing development dependencies. --- requirements/development.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements/development.txt b/requirements/development.txt index 35b2621501..ff919ce75d 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -11,3 +11,5 @@ ipython==4.0.0 transifex-client==0.10 wheel==0.26.0 + +-r testing-base.txt From 59624d75cb99219c726f10e73bda2bbcae1b3301 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 13:00:45 -0400 Subject: [PATCH 02/20] Fix GitLab issue #250 "Empty optional lookup metadata trigger validation error". Thanks to LeVon Smoker for the find and for the proposed fix. Reference: https://groups.google.com/forum/#!topic/mayan-edms/VUGRl4xX-1c --- mayan/apps/metadata/models.py | 2 +- mayan/apps/metadata/tests/test_models.py | 30 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mayan/apps/metadata/models.py b/mayan/apps/metadata/models.py index 8b4784b27a..619a19aa4a 100644 --- a/mayan/apps/metadata/models.py +++ b/mayan/apps/metadata/models.py @@ -126,7 +126,7 @@ class MetadataType(models.Model): if self.lookup: lookup_options = self.get_lookup_values() - if value not in lookup_options: + if value and value not in lookup_options: raise ValidationError( _('Value is not one of the provided options.') ) diff --git a/mayan/apps/metadata/tests/test_models.py b/mayan/apps/metadata/tests/test_models.py index 4826a7c64a..3d96286a64 100644 --- a/mayan/apps/metadata/tests/test_models.py +++ b/mayan/apps/metadata/tests/test_models.py @@ -63,8 +63,9 @@ class MetadataTestCase(TestCase): self.document.metadata_value_of.test, TEST_DEFAULT_VALUE ) - def test_lookup(self): + def test_lookup_with_incorrect_value(self): self.metadata_type.lookup = TEST_LOOKUP_TEMPLATE + self.metadata_type.save() document_metadata = DocumentMetadata( document=self.document, metadata_type=self.metadata_type, @@ -76,8 +77,15 @@ class MetadataTestCase(TestCase): document_metadata.full_clean() document_metadata.save() - # Should not return error - document_metadata.value = TEST_CORRECT_LOOKUP_VALUE + def test_lookup_with_correct_value(self): + self.metadata_type.lookup = TEST_LOOKUP_TEMPLATE + self.metadata_type.save() + + document_metadata = DocumentMetadata( + document=self.document, metadata_type=self.metadata_type, + value=TEST_CORRECT_LOOKUP_VALUE + ) + document_metadata.full_clean() document_metadata.save() @@ -85,6 +93,22 @@ class MetadataTestCase(TestCase): self.document.metadata_value_of.test, TEST_CORRECT_LOOKUP_VALUE ) + def test_empty_optional_lookup(self): + """ + Checks for GitLab issue #250 + Empty optional lookup metadata trigger validation error + """ + + self.metadata_type.lookup = TEST_LOOKUP_TEMPLATE + self.metadata_type.save() + + document_metadata = DocumentMetadata( + document=self.document, metadata_type=self.metadata_type + ) + + document_metadata.full_clean() + document_metadata.save() + def test_validation(self): self.metadata_type.validation = TEST_DATE_VALIDATOR From 511e3978502d298a635e602c30aa1548e44317d6 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 13:43:58 -0400 Subject: [PATCH 03/20] Add ability to disable the metadata update column. Disable the metadata update column in the new document upload wizard. --- mayan/apps/metadata/forms.py | 8 +++++--- mayan/apps/sources/wizards.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mayan/apps/metadata/forms.py b/mayan/apps/metadata/forms.py index df5e69bb6a..970e892d4f 100644 --- a/mayan/apps/metadata/forms.py +++ b/mayan/apps/metadata/forms.py @@ -16,15 +16,17 @@ class MetadataForm(forms.Form): widget=forms.TextInput(attrs={'readonly': 'readonly'}) ) value = forms.CharField(label=_('Value'), required=False) - update = forms.BooleanField( - initial=True, label=_('Update'), required=False - ) def __init__(self, *args, **kwargs): + self.disable_update_column = kwargs.pop('disable_update_column', False) super(MetadataForm, self).__init__(*args, **kwargs) # Set form fields initial values if 'initial' in kwargs: + if not kwargs['initial'].get('disable_update_column', False): + self.fields['update'] = forms.BooleanField( + initial=True, label=_('Update'), required=False + ) self.metadata_type = kwargs['initial']['metadata_type'] self.document_type = kwargs['initial']['document_type'] required_string = '' diff --git a/mayan/apps/sources/wizards.py b/mayan/apps/sources/wizards.py index 47f74d2a3c..cf799a6e41 100644 --- a/mayan/apps/sources/wizards.py +++ b/mayan/apps/sources/wizards.py @@ -59,6 +59,7 @@ class DocumentCreateWizard(ViewPermissionCheckMixin, SessionWizardView): for document_type_metadata_type in self.get_cleaned_data_for_step('0')['document_type'].metadata.all(): initial.append({ + 'disable_update_column': True, 'document_type': self.get_cleaned_data_for_step('0')['document_type'], 'metadata_type': document_type_metadata_type.metadata_type, }) From c67080c2d3d5529e76946b6cf3086f85c9c35943 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 13:47:00 -0400 Subject: [PATCH 04/20] Update HISTORY.rst --- HISTORY.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index c0219dade8..aaf859ed76 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,3 +1,9 @@ +2.0.2 (2016-02-09) +================== +- Install testing dependencies when installing development dependencies. +- Fix GitLab issue #250 "Empty optional lookup metadata trigger validation error". Thanks to LeVon Smoker for the find and for the proposed fix. +- Close GitLab issue #251 "Add method to disable metadata edit form "update" checkbox when not needed". This is used now to disable the metadata update column in the new document upload wizard. + 2.0.1 (2016-01-22) ================== - Fix GitLab issue #243, "System allows a user to skip entering values for a required metadata field while uploading a new document" From 16a1a4d3af72c331dbd5c10e14faef5e78f8c4be Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 19:07:24 -0400 Subject: [PATCH 05/20] Fix test test_get_document_version_content, API view return document version page OCR content not document version OCR content. --- mayan/apps/ocr/tests/test_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mayan/apps/ocr/tests/test_api.py b/mayan/apps/ocr/tests/test_api.py index 6e2ef8a01e..f72c1beebd 100644 --- a/mayan/apps/ocr/tests/test_api.py +++ b/mayan/apps/ocr/tests/test_api.py @@ -69,11 +69,11 @@ class OCRAPITestCase(APITestCase): self.assertTrue('Mayan EDMS Documentation' in content) - def test_get_document_version_content(self): + def test_get_document_version_page_content(self): response = self.client.get( reverse( 'rest_api:document-page-content-view', - args=(self.document.latest_version.pk,) + args=(self.document.latest_version.pages.first().pk,) ), ) From 79e1889e9500e0708811545ab2b1479c03b66ad0 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 19:08:13 -0400 Subject: [PATCH 06/20] Bump version to 2.0.2 --- mayan/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mayan/__init__.py b/mayan/__init__.py index f2ebf34dfa..80a146098f 100644 --- a/mayan/__init__.py +++ b/mayan/__init__.py @@ -1,8 +1,8 @@ from __future__ import unicode_literals __title__ = 'Mayan EDMS' -__version__ = '2.0.1' -__build__ = 0x020001 +__version__ = '2.0.2' +__build__ = 0x020002 __author__ = 'Roberto Rosario' __author_email__ = 'roberto.rosario@mayan-edms.com' __description__ = 'Free Open Source Electronic Document Management System' From 7e25ff0c0b7340e257253b9729a5198b106fd171 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 19:15:32 -0400 Subject: [PATCH 07/20] Add missing browser title generation tag to wizard template. --- mayan/apps/appearance/templates/appearance/generic_wizard.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mayan/apps/appearance/templates/appearance/generic_wizard.html b/mayan/apps/appearance/templates/appearance/generic_wizard.html index 58e35cc735..b3fe60da99 100644 --- a/mayan/apps/appearance/templates/appearance/generic_wizard.html +++ b/mayan/apps/appearance/templates/appearance/generic_wizard.html @@ -2,6 +2,8 @@ {% load i18n %} +{% block title %}{% include 'appearance/calculate_form_title.html' %}{% endblock %} + {% block content %}

{% include 'appearance/calculate_form_title.html' %}


From ca326440a20159f3ea47afcd33bbb726aeb3b41c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 19:37:52 -0400 Subject: [PATCH 08/20] Revert "Add ability to disable the metadata update column. Disable the metadata update column in the new document upload wizard." This reverts commit 511e3978502d298a635e602c30aa1548e44317d6. --- mayan/apps/metadata/forms.py | 8 +++----- mayan/apps/sources/wizards.py | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/mayan/apps/metadata/forms.py b/mayan/apps/metadata/forms.py index 970e892d4f..df5e69bb6a 100644 --- a/mayan/apps/metadata/forms.py +++ b/mayan/apps/metadata/forms.py @@ -16,17 +16,15 @@ class MetadataForm(forms.Form): widget=forms.TextInput(attrs={'readonly': 'readonly'}) ) value = forms.CharField(label=_('Value'), required=False) + update = forms.BooleanField( + initial=True, label=_('Update'), required=False + ) def __init__(self, *args, **kwargs): - self.disable_update_column = kwargs.pop('disable_update_column', False) super(MetadataForm, self).__init__(*args, **kwargs) # Set form fields initial values if 'initial' in kwargs: - if not kwargs['initial'].get('disable_update_column', False): - self.fields['update'] = forms.BooleanField( - initial=True, label=_('Update'), required=False - ) self.metadata_type = kwargs['initial']['metadata_type'] self.document_type = kwargs['initial']['document_type'] required_string = '' diff --git a/mayan/apps/sources/wizards.py b/mayan/apps/sources/wizards.py index cf799a6e41..47f74d2a3c 100644 --- a/mayan/apps/sources/wizards.py +++ b/mayan/apps/sources/wizards.py @@ -59,7 +59,6 @@ class DocumentCreateWizard(ViewPermissionCheckMixin, SessionWizardView): for document_type_metadata_type in self.get_cleaned_data_for_step('0')['document_type'].metadata.all(): initial.append({ - 'disable_update_column': True, 'document_type': self.get_cleaned_data_for_step('0')['document_type'], 'metadata_type': document_type_metadata_type.metadata_type, }) From f1b090f8d6b89d826ee9bf623d5c7291fd5a57f9 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 9 Feb 2016 19:41:43 -0400 Subject: [PATCH 09/20] Don't store empty metadata value if the update checkbox is not checked. --- mayan/apps/metadata/forms.py | 7 ++++--- mayan/apps/sources/wizards.py | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mayan/apps/metadata/forms.py b/mayan/apps/metadata/forms.py index df5e69bb6a..e6efe25132 100644 --- a/mayan/apps/metadata/forms.py +++ b/mayan/apps/metadata/forms.py @@ -80,9 +80,10 @@ class MetadataForm(forms.Form): ) def clean_value(self): - return self.metadata_type.validate_value( - document_type=self.document_type, value=self.cleaned_data['value'] - ) + if self.cleaned_data.get('update'): + return self.metadata_type.validate_value( + document_type=self.document_type, value=self.cleaned_data['value'] + ) MetadataFormSet = formset_factory(MetadataForm, extra=0) diff --git a/mayan/apps/sources/wizards.py b/mayan/apps/sources/wizards.py index 47f74d2a3c..2e6f3c3924 100644 --- a/mayan/apps/sources/wizards.py +++ b/mayan/apps/sources/wizards.py @@ -87,8 +87,9 @@ class DocumentCreateWizard(ViewPermissionCheckMixin, SessionWizardView): try: for identifier, metadata in enumerate(self.get_cleaned_data_for_step('1')): - query_dict['metadata%s_id' % identifier] = metadata['id'] - query_dict['metadata%s_value' % identifier] = metadata['value'] + if metadata.get('update'): + query_dict['metadata%s_id' % identifier] = metadata['id'] + query_dict['metadata%s_value' % identifier] = metadata['value'] except TypeError: pass From 03e7339f9bf0fd49e7f0cec3fdd1a480f7ec1b52 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 10 Feb 2016 02:26:57 -0400 Subject: [PATCH 10/20] Only extract validation error messages from ValidationError exception instances. --- mayan/apps/metadata/views.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/mayan/apps/metadata/views.py b/mayan/apps/metadata/views.py index 5f67012d17..55ebd37460 100644 --- a/mayan/apps/metadata/views.py +++ b/mayan/apps/metadata/views.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals from django.conf import settings from django.contrib import messages -from django.core.exceptions import PermissionDenied +from django.core.exceptions import PermissionDenied, ValidationError from django.core.urlresolvers import reverse, reverse_lazy from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render_to_response @@ -127,20 +127,24 @@ def metadata_edit(request, document_id=None, document_id_list=None): except Exception as exception: errors.append(exception) - if errors: - for error in errors: - if settings.DEBUG: - raise + for error in errors: + if settings.DEBUG: + raise + else: + if isinstance(error, ValidationError): + exception_message = ', '.join(error.messages) else: - messages.error( - request, _( - 'Error editing metadata for document: ' - '%(document)s; %(exception)s.' - ) % { - 'document': document, - 'exception': ', '.join(exception.messages) - } - ) + exception_message = unicode(error) + + messages.error( + request, _( + 'Error editing metadata for document: ' + '%(document)s; %(exception)s.' + ) % { + 'document': document, + 'exception': exception_message + } + ) else: messages.success( request, From f3d1faebf16b42a2b5f23176339aba3ef5346784 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 10 Feb 2016 02:27:42 -0400 Subject: [PATCH 11/20] Move metadata form value validation to .clean() and update field data may not be available yet when validatng the value field. Only validate form value if form has a metadata type associated. --- mayan/apps/metadata/forms.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mayan/apps/metadata/forms.py b/mayan/apps/metadata/forms.py index e6efe25132..30660c5246 100644 --- a/mayan/apps/metadata/forms.py +++ b/mayan/apps/metadata/forms.py @@ -79,12 +79,15 @@ class MetadataForm(forms.Form): attrs={'readonly': 'readonly'} ) - def clean_value(self): - if self.cleaned_data.get('update'): - return self.metadata_type.validate_value( - document_type=self.document_type, value=self.cleaned_data['value'] + def clean(self): + if self.cleaned_data.get('update') and hasattr(self, 'metadata_type'): + self.cleaned_data['value'] = self.metadata_type.validate_value( + document_type=self.document_type, + value=self.cleaned_data.get('value') ) + return self.cleaned_data + MetadataFormSet = formset_factory(MetadataForm, extra=0) From c3b0146b96353df9dfe277638c2b479bf3cd019f Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 10 Feb 2016 03:03:04 -0400 Subject: [PATCH 12/20] Update changelog. --- HISTORY.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index aaf859ed76..57fa9afa90 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,7 +2,10 @@ ================== - Install testing dependencies when installing development dependencies. - Fix GitLab issue #250 "Empty optional lookup metadata trigger validation error". Thanks to LeVon Smoker for the find and for the proposed fix. -- Close GitLab issue #251 "Add method to disable metadata edit form "update" checkbox when not needed". This is used now to disable the metadata update column in the new document upload wizard. +- Fix OCR API test for document version page OCR content. +- Move metadata form value validation to .clean() and update field data may not be available yet when validatng the value field. Only validate form value if form has a metadata type associated. +- Only extract validation error messages from ValidationError exception instances. +- Don't store empty metadata value if the update checkbox is not checked. 2.0.1 (2016-01-22) ================== From 7db560d7990fcdc7126fe37886d496823b579fd7 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 10 Feb 2016 12:10:42 -0400 Subject: [PATCH 13/20] Increase delay in test from 1 second to 2 seconds to workaround MySQL truncating millisecond part of timestamp. --- mayan/apps/documents/tests/test_models.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index 0e844013b6..52945f03f1 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -85,8 +85,8 @@ class DocumentTestCase(TestCase): def test_auto_trashing(self): """ - Test document type trashing policies. Documents are moved to the trash, - x amount of time after being uploaded + Test document type trashing policies. Documents are moved to the + trash, x amount of time after being uploaded """ self.document_type.trash_time_period = 1 @@ -94,7 +94,9 @@ class DocumentTestCase(TestCase): self.document_type.trash_time_unit = 'seconds' self.document_type.save() - time.sleep(1) + # Needed by MySQL as milliseconds value is not store in timestamp + # field + time.sleep(2) self.assertEqual(Document.objects.count(), 1) self.assertEqual(DeletedDocument.objects.count(), 0) @@ -123,6 +125,8 @@ class DocumentTestCase(TestCase): self.assertEqual(Document.objects.count(), 0) self.assertEqual(DeletedDocument.objects.count(), 1) + # Needed by MySQL as milliseconds value is not store in timestamp + # field time.sleep(2) DocumentType.objects.check_delete_periods() @@ -216,8 +220,9 @@ class DocumentVersionTestCase(TestCase): def test_revert_version(self): self.assertEqual(self.document.versions.count(), 1) - # Needed by MySQL as milliseconds value is not store in timestamp field - time.sleep(1) + # Needed by MySQL as milliseconds value is not store in timestamp + # field + time.sleep(2) with open(TEST_DOCUMENT_PATH) as file_object: self.document.new_version( From 0295f7feb550b425ab8fe8ae729a247c2ae0955a Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 10 Feb 2016 12:11:51 -0400 Subject: [PATCH 14/20] Add 2 second delay to workaround MySQL not storing millisecond part of timestamp. --- mayan/apps/documents/tests/test_links.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mayan/apps/documents/tests/test_links.py b/mayan/apps/documents/tests/test_links.py index 34ce90a01d..44e168ee90 100644 --- a/mayan/apps/documents/tests/test_links.py +++ b/mayan/apps/documents/tests/test_links.py @@ -2,6 +2,8 @@ from __future__ import unicode_literals +import time + from django.core.files import File from django.core.urlresolvers import reverse @@ -37,6 +39,10 @@ class DocumentsLinksTestCase(GenericDocumentViewTestCase): self.assertEqual(resolved_link, None) def test_document_version_revert_link_with_permission(self): + # Needed by MySQL as milliseconds value is not store in timestamp + # field + time.sleep(2) + with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document.new_version(file_object=File(file_object)) From bfa6c51f86debe7ad0bd28bebd26cd51d2de2305 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 11 Feb 2016 03:08:10 -0400 Subject: [PATCH 15/20] Configure GitLab-CI mysql service to use UTF-8 and fix failing test in MySQL. --- .gitlab-ci.yml | 1 + HISTORY.rst | 1 + contrib/testing/gitlab-ci/database.yml.mysql | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 contrib/testing/gitlab-ci/database.yml.mysql diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c7ed5587b6..ef03628d87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,7 @@ test:mysql: - pip install -r requirements/testing.txt - pip install -q mysql-python - apt-get install -qq mysql-client + - cp contrib/testing/gitlab-ci/database.yml.mysql config/database.yml - mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -e "ALTER DATABASE $MYSQL_DATABASE CHARACTER SET utf8 COLLATE utf8_unicode_ci;" - coverage run manage.py runtests --settings=mayan.settings.testing.gitlab-ci.db_mysql --nomigrations - bash <(curl https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t $CODECOV_TOKEN diff --git a/HISTORY.rst b/HISTORY.rst index 57fa9afa90..dda5d8df10 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,7 @@ - Move metadata form value validation to .clean() and update field data may not be available yet when validatng the value field. Only validate form value if form has a metadata type associated. - Only extract validation error messages from ValidationError exception instances. - Don't store empty metadata value if the update checkbox is not checked. +- Add 2 second delay to document version tests to workaround MySQL not storing the millisecond part of the document version's timestamp. 2.0.1 (2016-01-22) ================== diff --git a/contrib/testing/gitlab-ci/database.yml.mysql b/contrib/testing/gitlab-ci/database.yml.mysql new file mode 100644 index 0000000000..78665e81f1 --- /dev/null +++ b/contrib/testing/gitlab-ci/database.yml.mysql @@ -0,0 +1,10 @@ +test: &test + adapter: mysql2 + collation: utf8_general_ci + database: gitlabhq_test + encoding: utf8 + password: + pool: 5 + reconnect: false + # socket: /tmp/mysql.sock + username: root From c5c0ad0cce605797e59405c4dc547fb08f709d9b Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 11 Feb 2016 03:55:27 -0400 Subject: [PATCH 16/20] Revert "Configure GitLab-CI mysql service to use UTF-8 and fix failing test in MySQL." This reverts commit bfa6c51f86debe7ad0bd28bebd26cd51d2de2305. --- .gitlab-ci.yml | 1 - HISTORY.rst | 1 - contrib/testing/gitlab-ci/database.yml.mysql | 10 ---------- 3 files changed, 12 deletions(-) delete mode 100644 contrib/testing/gitlab-ci/database.yml.mysql diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef03628d87..c7ed5587b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,6 @@ test:mysql: - pip install -r requirements/testing.txt - pip install -q mysql-python - apt-get install -qq mysql-client - - cp contrib/testing/gitlab-ci/database.yml.mysql config/database.yml - mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -e "ALTER DATABASE $MYSQL_DATABASE CHARACTER SET utf8 COLLATE utf8_unicode_ci;" - coverage run manage.py runtests --settings=mayan.settings.testing.gitlab-ci.db_mysql --nomigrations - bash <(curl https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t $CODECOV_TOKEN diff --git a/HISTORY.rst b/HISTORY.rst index dda5d8df10..57fa9afa90 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,7 +6,6 @@ - Move metadata form value validation to .clean() and update field data may not be available yet when validatng the value field. Only validate form value if form has a metadata type associated. - Only extract validation error messages from ValidationError exception instances. - Don't store empty metadata value if the update checkbox is not checked. -- Add 2 second delay to document version tests to workaround MySQL not storing the millisecond part of the document version's timestamp. 2.0.1 (2016-01-22) ================== diff --git a/contrib/testing/gitlab-ci/database.yml.mysql b/contrib/testing/gitlab-ci/database.yml.mysql deleted file mode 100644 index 78665e81f1..0000000000 --- a/contrib/testing/gitlab-ci/database.yml.mysql +++ /dev/null @@ -1,10 +0,0 @@ -test: &test - adapter: mysql2 - collation: utf8_general_ci - database: gitlabhq_test - encoding: utf8 - password: - pool: 5 - reconnect: false - # socket: /tmp/mysql.sock - username: root From ed70f96b49d5ec438733cad7b26ad0d30de5409c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 11 Feb 2016 04:05:08 -0400 Subject: [PATCH 17/20] Update changelog. --- HISTORY.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.rst b/HISTORY.rst index 57fa9afa90..dda5d8df10 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,7 @@ - Move metadata form value validation to .clean() and update field data may not be available yet when validatng the value field. Only validate form value if form has a metadata type associated. - Only extract validation error messages from ValidationError exception instances. - Don't store empty metadata value if the update checkbox is not checked. +- Add 2 second delay to document version tests to workaround MySQL not storing the millisecond part of the document version's timestamp. 2.0.1 (2016-01-22) ================== From 3fdc5e523ad58d531f574c63731fb73e4c805823 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 13 Feb 2016 17:35:43 -0400 Subject: [PATCH 18/20] Strip tags from browser title. --- .../appearance/templates/appearance/calculate_form_title.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mayan/apps/appearance/templates/appearance/calculate_form_title.html b/mayan/apps/appearance/templates/appearance/calculate_form_title.html index da6f1c075a..e27204e32c 100644 --- a/mayan/apps/appearance/templates/appearance/calculate_form_title.html +++ b/mayan/apps/appearance/templates/appearance/calculate_form_title.html @@ -1,7 +1,7 @@ {% load i18n %} {% if title %} - {{ title }} + {{ title|striptags }} {% else %} {% if read_only %} {% blocktrans %}Details for: {{ object }}{% endblocktrans %} From 11a9d10e0ff9114f386e3aa675c663c23d5785b0 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 14 Feb 2016 21:06:33 -0400 Subject: [PATCH 19/20] Add 2.0.2 release notes. --- HISTORY.rst | 9 +++-- docs/releases/2.0.2.rst | 90 +++++++++++++++++++++++++++++++++++++++++ docs/releases/index.rst | 2 + 3 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 docs/releases/2.0.2.rst diff --git a/HISTORY.rst b/HISTORY.rst index dda5d8df10..0d971dc058 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,12 +1,13 @@ 2.0.2 (2016-02-09) ================== - Install testing dependencies when installing development dependencies. -- Fix GitLab issue #250 "Empty optional lookup metadata trigger validation error". Thanks to LeVon Smoker for the find and for the proposed fix. -- Fix OCR API test for document version page OCR content. -- Move metadata form value validation to .clean() and update field data may not be available yet when validatng the value field. Only validate form value if form has a metadata type associated. +- Fix GitLab issue #250 "Empty optional lookup metadata trigger validation error". +- Fix OCR API test. +- Move metadata form value validation to .clean() method. - Only extract validation error messages from ValidationError exception instances. - Don't store empty metadata value if the update checkbox is not checked. -- Add 2 second delay to document version tests to workaround MySQL not storing the millisecond part of the document version's timestamp. +- Add 2 second delay to document version tests to workaround MySQL limitation. +- Strip HTML tags from the browser title. 2.0.1 (2016-01-22) ================== diff --git a/docs/releases/2.0.2.rst b/docs/releases/2.0.2.rst new file mode 100644 index 0000000000..5470fac574 --- /dev/null +++ b/docs/releases/2.0.2.rst @@ -0,0 +1,90 @@ +=============================== +Mayan EDMS v2.0.2 release notes +=============================== + +Released: February 15, 2016 + +Welcome to Mayan EDMS v2.0.2 + +What's new +========== + +Fine tune "Update" checkbox from the metadata entry form +-------------------------------------------------------- +Previously the update checkbox was ignored during the metadata step of the +document upload wizard with the wizard always creating a metadata entry for the +new document even if the entry was left blank. The checkbox now controls whether +or not the wizard will store try to create the metadata entry. + +Fix empty optional lookup metadata fields behavior +-------------------------------------------------- +An edge case was fixed that caused validation to be executed for empty metadata +fields that had a value lookup list. + + +Other changes +------------- +- Only extract validation error messages from ValidationError exception instances. +- Add 2 second delay to document version tests to workaround MySQL not storing + the millisecond part of the document version's timestamp. +- Install testing dependencies when installing development dependencies. +- Fix OCR API test for document version page OCR content. +- Move metadata form value validation to .clean() method. +- Add HTML tags stripping to the browser title generation template. + +Removals +-------- +* None + +Upgrading from a previous version +--------------------------------- + +Using PIP +~~~~~~~~~ + +Type in the console:: + + $ pip install -U mayan-edms + +the requirements will also be updated automatically. + +Using Git +~~~~~~~~~ + +If you installed Mayan EDMS by cloning the Git repository issue the commands:: + + $ git reset --hard HEAD + $ git pull + +otherwise download the compressed archived and uncompress it overriding the +existing installation. + +Next upgrade/add the new requirements:: + + $ pip install --upgrade -r requirements.txt + +Common steps +~~~~~~~~~~~~ + +Migrate existing database schema with:: + + $ mayan-edms.py performupgrade + +Add new static media:: + + $ mayan-edms.py collectstatic --noinput + +The upgrade procedure is now complete. + + +Backward incompatible changes +============================= + +* None + +Bugs fixed or issues closed +=========================== + +* `GitLab issue #250 `_ Empty optional lookup metadata trigger validation error. + +.. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/docs/releases/index.rst b/docs/releases/index.rst index ba35ac60e1..ceabfccbb1 100644 --- a/docs/releases/index.rst +++ b/docs/releases/index.rst @@ -23,6 +23,8 @@ versions of the documentation contain the release notes for any later releases. :maxdepth: 1 2.0 + 2.0.1 + 2.0.2 1.0 series ---------- From 378a346e7970e06023eda4a7e48567dcc4828740 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 14 Feb 2016 21:30:08 -0400 Subject: [PATCH 20/20] Remove Docker and Docker Componse files. These files now live in https://gitlab.com/mayan-edms/mayan-edms-docker. --- .dockerignore | 2 -- Dockerfile | 40 ----------------------------------- HISTORY.rst | 1 + docker-compose.yml | 21 ------------------ docker/bin/run.sh | 10 --------- docker/conf/mayan/settings.py | 15 ------------- docker/conf/nginx/mayan-edms | 22 ------------------- docker/conf/uwsgi/uwsgi.ini | 14 ------------ docker/entrypoint.sh | 17 --------------- docs/releases/2.0.2.rst | 4 ++++ environment | 3 --- 11 files changed, 5 insertions(+), 144 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml delete mode 100755 docker/bin/run.sh delete mode 100644 docker/conf/mayan/settings.py delete mode 100644 docker/conf/nginx/mayan-edms delete mode 100644 docker/conf/uwsgi/uwsgi.ini delete mode 100755 docker/entrypoint.sh delete mode 100644 environment diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 94515f8807..0000000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!docker diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 587fe9f65f..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM ubuntu:15.04 - -MAINTAINER Roberto Rosario "roberto.rosario@mayan-edms.com" - -# Install base Ubuntu libraries -RUN apt-get update && apt-get install -y netcat-openbsd python-dev python-pip gpgv nginx libpq-dev git-core libjpeg-dev libmagic1 libpng-dev libreoffice libtiff-dev gcc ghostscript gpgv tesseract-ocr unpaper poppler-utils && apt-get clean && rm -rf /var/lib/apt/lists/* && rm -f /var/cache/apt/archives/*.deb - -ENV MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan - -# Install Mayan EDMS, latest production release -RUN pip install mayan-edms==2.0.0 - -# Install Python clients for PostgreSQL, REDIS, and uWSGI -RUN pip install psycopg2 redis uwsgi - -# Create Mayan EDMS basic settings/local.py file -RUN mayan-edms.py createsettings - -# Install Mayan EDMS static media files -RUN mayan-edms.py collectstatic --noinput - -ADD docker /docker - -# Setup Mayan EDMS settings file overrides -RUN cat /docker/conf/mayan/settings.py >> $MAYAN_INSTALL_DIR/settings/local.py - -# Setup NGINX -RUN rm /etc/nginx/sites-enabled/default -RUN ln -s /docker/conf/nginx/mayan-edms /etc/nginx/sites-enabled/mayan-edms - -# Setup UWSGI -RUN mkdir /var/log/uwsgi - -# Persistent Mayan EDMS files -VOLUME $MAYAN_INSTALL_DIR/media - -ENTRYPOINT ["/docker/entrypoint.sh"] - -EXPOSE 80 -CMD ["/docker/bin/run.sh"] diff --git a/HISTORY.rst b/HISTORY.rst index 0d971dc058..93cee24ac2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,6 +8,7 @@ - Don't store empty metadata value if the update checkbox is not checked. - Add 2 second delay to document version tests to workaround MySQL limitation. - Strip HTML tags from the browser title. +- Remove Docker and Docker Compose files. 2.0.1 (2016-01-22) ================== diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 371f567166..0000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,21 +0,0 @@ -postgres: - env_file: - - ./environment - image: postgres - volumes: - - /var/lib/postgresql/data - -redis: - image: redis - -mayan-edms: - env_file: - - ./environment - image: mayanedms/monolithic - links: - - postgres - - redis - ports: - - "80:80" - volumes: - - /usr/local/lib/python2.7/dist-packages/mayan/media diff --git a/docker/bin/run.sh b/docker/bin/run.sh deleted file mode 100755 index ad74092f90..0000000000 --- a/docker/bin/run.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Launch NGINX daemon -nginx - -# Launch the workers -mayan-edms.py celery worker --settings=mayan.settings.production -Ofair -l ERROR -B & - -# Launch uWSGI in foreground -/usr/local/bin/uwsgi --ini /docker/conf/uwsgi/uwsgi.ini diff --git a/docker/conf/mayan/settings.py b/docker/conf/mayan/settings.py deleted file mode 100644 index 50b90ae9bc..0000000000 --- a/docker/conf/mayan/settings.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': os.environ.get('POSTGRES_DB'), - 'USER': os.environ.get('POSTGRES_USER'), - 'PASSWORD': os.environ.get('POSTGRES_PASSWORD'), - 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR'), - 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT'), - } -} - -BROKER_URL = 'redis://{}:{}/0'.format(os.environ.get('REDIS_PORT_6379_TCP_ADDR'), os.environ.get('REDIS_PORT_6379_TCP_PORT')) -CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(os.environ.get('REDIS_PORT_6379_TCP_ADDR'), os.environ.get('REDIS_PORT_6379_TCP_PORT')) diff --git a/docker/conf/nginx/mayan-edms b/docker/conf/nginx/mayan-edms deleted file mode 100644 index 3522f55517..0000000000 --- a/docker/conf/nginx/mayan-edms +++ /dev/null @@ -1,22 +0,0 @@ -server { - listen 80; - server_name localhost; - - location / { - include uwsgi_params; - uwsgi_pass unix:/run/mayan.sock; - - client_max_body_size 30M; # Increse if your plan to upload bigger documents - proxy_read_timeout 30s; # Increase if your document uploads take more than 30 seconds - } - - location /static { - alias /usr/local/lib/python2.7/dist-packages/mayan/media/static; - expires 1h; - } - - location /favicon.ico { - alias /usr/local/lib/python2.7/dist-packages/mayan/media/static/appearance/images/favicon.ico; - expires 1h; - } -} diff --git a/docker/conf/uwsgi/uwsgi.ini b/docker/conf/uwsgi/uwsgi.ini deleted file mode 100644 index 6e2e1ff95f..0000000000 --- a/docker/conf/uwsgi/uwsgi.ini +++ /dev/null @@ -1,14 +0,0 @@ -[uwsgi] -chdir = $(MAYAN_INSTALL_DIR) -chmod-socket = 664 -chown-socket = www-data:www-data -env = DJANGO_SETTINGS_MODULE=mayan.settings.production -gid = root -logto = /var/log/uwsgi/%n.log -pythonpath = /usr/local/lib/python2.7/dist-packages -master = True -max-requests = 5000 -socket = /run/mayan.sock -uid = root -vacuum = True -wsgi-file = $(MAYAN_INSTALL_DIR)/wsgi.py diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100755 index 13fe1f395a..0000000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -e - -if [[ -z $POSTGRES_PORT_5432_TCP_ADDR ]]; then - echo "** ERROR: You need to link the Postgres container." - exit 1 -fi - -until nc -z $POSTGRES_PORT_5432_TCP_ADDR $POSTGRES_PORT_5432_TCP_PORT; do - echo "$(date) - waiting for Postgres..." - sleep 1 -done - -# Migrate database, create initial admin user -mayan-edms.py initialsetup - -exec "$@" diff --git a/docs/releases/2.0.2.rst b/docs/releases/2.0.2.rst index 5470fac574..a4378ba89e 100644 --- a/docs/releases/2.0.2.rst +++ b/docs/releases/2.0.2.rst @@ -21,6 +21,10 @@ Fix empty optional lookup metadata fields behavior An edge case was fixed that caused validation to be executed for empty metadata fields that had a value lookup list. +Remove Docker files +------------------- +Included Docker and Docker Compose files were removed since the Mayan EDMS Docker +(https://gitlab.com/mayan-edms/mayan-edms-docker) repository is stable. Other changes ------------- diff --git a/environment b/environment deleted file mode 100644 index 2ef2c9d6c2..0000000000 --- a/environment +++ /dev/null @@ -1,3 +0,0 @@ -POSTGRES_DB=mayan -POSTGRES_PASSWORD=mayanpassword -POSTGRES_USER=mayan