Merge branch 'versions/micro'
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
3.2.6 (2019-07-XX)
|
||||
==================
|
||||
* Remove the smart settings app * import.
|
||||
* Encode settings YAML before hashing.
|
||||
* Fix document icon used in the workflow runtime links.
|
||||
* Add trashed date time label.
|
||||
|
||||
3.2.5 (2019-07-05)
|
||||
==================
|
||||
* Don't error out if the EXTRA_APPS or the DISABLED_APPS settings
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import DEFAULT_MAXIMUM_TITLE_LENGTH
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import DEFAULT_LOGIN_METHOD, DEFAULT_MAXIMUM_SESSION_LENGTH
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import DEFAULT_EMAIL, DEFAULT_PASSWORD, DEFAULT_USERNAME
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
import mayan
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import DEFAULT_COMMON_HOME_VIEW
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import (
|
||||
DEFAULT_LIBREOFFICE_PATH, DEFAULT_PDFTOPPM_DPI, DEFAULT_PDFTOPPM_FORMAT,
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Signatures'), name='django_gpg')
|
||||
|
||||
|
||||
@@ -14,7 +14,11 @@ from .literals import TEST_INDEX_LABEL, TEST_INDEX_LABEL_EDITED
|
||||
from .mixins import IndexTestMixin, IndexViewTestMixin
|
||||
|
||||
|
||||
class IndexViewTestCase(IndexTestMixin, IndexViewTestMixin, GenericDocumentViewTestCase):
|
||||
class IndexViewTestCase(
|
||||
IndexTestMixin, IndexViewTestMixin, GenericDocumentViewTestCase
|
||||
):
|
||||
auto_upload_document = False
|
||||
|
||||
def test_index_create_view_no_permission(self):
|
||||
response = self._request_test_index_create_view()
|
||||
self.assertEqual(response.status_code, 403)
|
||||
@@ -72,6 +76,10 @@ class IndexViewTestCase(IndexTestMixin, IndexViewTestMixin, GenericDocumentViewT
|
||||
self.test_index.refresh_from_db()
|
||||
self.assertEqual(self.test_index.label, TEST_INDEX_LABEL_EDITED)
|
||||
|
||||
|
||||
class IndexInstanceViewTestCase(
|
||||
IndexTestMixin, IndexViewTestMixin, GenericDocumentViewTestCase
|
||||
):
|
||||
def _request_index_instance_node_view(self, index_instance_node):
|
||||
return self.get(
|
||||
viewname='indexing:index_instance_node_view', kwargs={
|
||||
@@ -100,27 +108,27 @@ class IndexViewTestCase(IndexTestMixin, IndexViewTestMixin, GenericDocumentViewT
|
||||
)
|
||||
self.assertContains(response, text=TEST_INDEX_LABEL, status_code=200)
|
||||
|
||||
def _request_index_rebuild_get_view(self):
|
||||
def _request_indexes_rebuild_get_view(self):
|
||||
return self.get(
|
||||
viewname='indexing:rebuild_index_instances',
|
||||
)
|
||||
|
||||
def _request_index_rebuild_post_view(self):
|
||||
def _request_indexes_rebuild_post_view(self):
|
||||
return self.post(
|
||||
viewname='indexing:rebuild_index_instances', data={
|
||||
'index_templates': self.test_index.pk
|
||||
}
|
||||
)
|
||||
|
||||
def test_index_rebuild_no_permission(self):
|
||||
def test_indexes_rebuild_no_permission(self):
|
||||
self._create_test_index(rebuild=False)
|
||||
|
||||
response = self._request_index_rebuild_get_view()
|
||||
response = self._request_indexes_rebuild_get_view()
|
||||
self.assertNotContains(
|
||||
response=response, text=self.test_index.label, status_code=200
|
||||
)
|
||||
|
||||
response = self._request_index_rebuild_post_view()
|
||||
response = self._request_indexes_rebuild_post_view()
|
||||
# No error since we just don't see the index
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@@ -128,7 +136,7 @@ class IndexViewTestCase(IndexTestMixin, IndexViewTestMixin, GenericDocumentViewT
|
||||
self.test_index.instance_root.get_children_count(), 0
|
||||
)
|
||||
|
||||
def test_index_rebuild_with_access(self):
|
||||
def test_indexes_rebuild_with_access(self):
|
||||
self._create_test_index(rebuild=False)
|
||||
|
||||
self.grant_access(
|
||||
@@ -136,12 +144,12 @@ class IndexViewTestCase(IndexTestMixin, IndexViewTestMixin, GenericDocumentViewT
|
||||
permission=permission_document_indexing_rebuild
|
||||
)
|
||||
|
||||
response = self._request_index_rebuild_get_view()
|
||||
response = self._request_indexes_rebuild_get_view()
|
||||
self.assertContains(
|
||||
response=response, text=self.test_index.label, status_code=200
|
||||
)
|
||||
|
||||
response = self._request_index_rebuild_post_view()
|
||||
response = self._request_indexes_rebuild_post_view()
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
# An instance root exists
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Document parsing'), name='document_parsing')
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Document signatures'), name='signatures')
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from mayan.apps.appearance.classes import Icon
|
||||
from mayan.apps.documents.icons import icon_document_type
|
||||
from mayan.apps.documents.icons import icon_document, icon_document_type
|
||||
|
||||
|
||||
icon_workflow = Icon(driver_name='fontawesome', symbol='sitemap')
|
||||
@@ -31,11 +31,11 @@ icon_workflow_instance_transition = Icon(
|
||||
driver_name='fontawesome', symbol='arrows-alt-h'
|
||||
)
|
||||
|
||||
icon_workflow_runtime_proxy_document_list = icon_document_type
|
||||
icon_workflow_runtime_proxy_document_list = icon_document
|
||||
icon_workflow_runtime_proxy_list = Icon(
|
||||
driver_name='fontawesome', symbol='sitemap'
|
||||
)
|
||||
icon_workflow_runtime_proxy_state_document_list = icon_document_type
|
||||
icon_workflow_runtime_proxy_state_document_list = icon_document
|
||||
icon_workflow_runtime_proxy_state_list = Icon(
|
||||
driver_name='fontawesome', symbol='circle'
|
||||
)
|
||||
|
||||
@@ -319,7 +319,8 @@ class DocumentsApp(MayanAppConfig):
|
||||
attribute='document_type', is_sortable=True, source=DeletedDocument
|
||||
)
|
||||
SourceColumn(
|
||||
attribute='deleted_date_time', source=DeletedDocument
|
||||
attribute='deleted_date_time', include_label=True, order=99,
|
||||
source=DeletedDocument
|
||||
)
|
||||
|
||||
# DocumentVersion
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import (
|
||||
DEFAULT_DOCUMENTS_HASH_BLOCK_SIZE, DEFAULT_LANGUAGE, DEFAULT_LANGUAGE_CODES
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import DEFAULT_EXIF_PATH
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import DEFAULT_BACKEND, DEFAULT_LOCK_TIMEOUT_VALUE
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .literals import (
|
||||
DEFAULT_DOCUMENT_BODY_TEMPLATE, DEFAULT_LINK_BODY_TEMPLATE
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
from .parsers import MetadataParser
|
||||
from .validators import MetadataValidator
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Mirroring'), name='mirroring')
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('OCR'), name='ocr')
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .classes import Namespace, Setting # NOQA
|
||||
|
||||
default_app_config = 'mayan.apps.smart_settings.apps.SmartSettingsApp'
|
||||
|
||||
@@ -17,7 +17,9 @@ except ImportError:
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.encoding import (
|
||||
force_bytes, force_text, python_2_unicode_compatible
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -141,7 +143,7 @@ class Setting(object):
|
||||
@classmethod
|
||||
def get_hash(cls):
|
||||
return force_text(
|
||||
hashlib.sha256(cls.dump_data()).hexdigest()
|
||||
hashlib.sha256(force_bytes(cls.dump_data())).hexdigest()
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -11,12 +11,13 @@ from mayan.apps.common.settings import setting_paginate_by
|
||||
from mayan.apps.common.tests import BaseTestCase
|
||||
from mayan.apps.storage.utils import fs_cleanup
|
||||
|
||||
from ..classes import Setting
|
||||
from ..classes import Namespace, Setting
|
||||
|
||||
from .literals import ENVIRONMENT_TEST_NAME, ENVIRONMENT_TEST_VALUE
|
||||
from .mixins import SmartSettingTestMixin
|
||||
|
||||
|
||||
class ClassesTestCase(BaseTestCase):
|
||||
class ClassesTestCase(SmartSettingTestMixin, BaseTestCase):
|
||||
def test_environment_variable(self):
|
||||
os.environ[
|
||||
'MAYAN_{}'.format(ENVIRONMENT_TEST_NAME)
|
||||
@@ -39,3 +40,16 @@ class ClassesTestCase(BaseTestCase):
|
||||
|
||||
with path_config_backup.open(mode='r') as file_object:
|
||||
self.assertFalse('!!python/' in file_object.read())
|
||||
|
||||
def test_setting_check_changed(self):
|
||||
self._create_test_settings_namespace()
|
||||
test_setting = self.test_settings_namespace.add_setting(
|
||||
global_name='SMART_SETTINGS_TEST_SETTING',
|
||||
default='test value'
|
||||
)
|
||||
# Initialize hash cache
|
||||
Setting.check_changed()
|
||||
self.assertFalse(Setting.check_changed())
|
||||
test_setting.value = 'test value edited'
|
||||
self.assertTrue(Setting.check_changed())
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Sources'), name='sources')
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import tempfile
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Storage'), name='storage')
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(name='mayan', label=_('Mayan'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user