From 93c4814a89ed9490c6c487b379cda93e887d82f5 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 12 Apr 2019 04:15:24 -0400 Subject: [PATCH] New default values for settings New default value for setting DOCUMENTS_HASH_BLOCK_SIZE is 65535. New default value for setting MIMETYPE_FILE_READ_SIZE is 1024. Signed-off-by: Roberto Rosario --- HISTORY.rst | 5 +++++ docs/releases/3.2.rst | 6 +++++- mayan/apps/documents/literals.py | 1 + mayan/apps/documents/settings.py | 8 +++++--- mayan/apps/mimetype/literals.py | 3 +++ mayan/apps/mimetype/settings.py | 5 ++++- 6 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 mayan/apps/mimetype/literals.py diff --git a/HISTORY.rst b/HISTORY.rst index 84e6918fac..d4bfd1b893 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -28,6 +28,11 @@ safe_dump to load and dump using the SafeLoader. * Add SilenceLoggerTestCaseMixin to lower level of loggers during tests. +* New default value for setting DOCUMENTS_HASH_BLOCK_SIZE is + 65535. +* New default value for setting MIMETYPE_FILE_READ_SIZE is + 1024. + 3.1.11 (2019-04-XX) =================== diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index 2cb50f40a9..565e89f8d8 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -22,7 +22,6 @@ Existing config.yml files need to be updated manually. Permissions ^^^^^^^^^^^ - The role permission grant and revoke permissions were removed. Instead only the role edit permission is required to grant or revoke permissions to a role. @@ -35,6 +34,11 @@ Move the development URL definitions for Rosetta and Debug toolbar to a separate URL file. Convert the single urls.py to a module to allow multiple URL files to be used. +Settings +^^^^^^^^ + +New default value for setting DOCUMENTS_HASH_BLOCK_SIZE is 65535. +New default value for setting MIMETYPE_FILE_READ_SIZE is 1024. Other changes ^^^^^^^^^^^^^ diff --git a/mayan/apps/documents/literals.py b/mayan/apps/documents/literals.py index 2c3fe0bccf..c56f92d39b 100644 --- a/mayan/apps/documents/literals.py +++ b/mayan/apps/documents/literals.py @@ -9,6 +9,7 @@ CHECK_TRASH_PERIOD_INTERVAL = 60 DELETE_STALE_STUBS_INTERVAL = 60 * 10 # 10 minutes DEFAULT_DELETE_PERIOD = 30 DEFAULT_DELETE_TIME_UNIT = TIME_DELTA_UNIT_DAYS +DEFAULT_DOCUMENTS_HASH_BLOCK_SIZE = 65535 DEFAULT_LANGUAGE = 'eng' DEFAULT_LANGUAGE_CODES = ( 'ilo', 'run', 'uig', 'hin', 'pan', 'pnb', 'wuu', 'msa', 'kxd', 'ind', diff --git a/mayan/apps/documents/settings.py b/mayan/apps/documents/settings.py index 8d51f29e70..f6137509fa 100644 --- a/mayan/apps/documents/settings.py +++ b/mayan/apps/documents/settings.py @@ -7,7 +7,9 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.smart_settings import Namespace -from .literals import DEFAULT_LANGUAGE, DEFAULT_LANGUAGE_CODES +from .literals import ( + DEFAULT_DOCUMENTS_HASH_BLOCK_SIZE, DEFAULT_LANGUAGE, DEFAULT_LANGUAGE_CODES +) namespace = Namespace(name='documents', label=_('Documents')) @@ -63,8 +65,8 @@ setting_fix_orientation = namespace.add_setting( ) ) setting_hash_block_size = namespace.add_setting( - global_name='DOCUMENTS_HASH_BLOCK_SIZE', default=0, - help_text=_( + global_name='DOCUMENTS_HASH_BLOCK_SIZE', + default=DEFAULT_DOCUMENTS_HASH_BLOCK_SIZE, help_text=_( 'Size of blocks to use when calculating the document file\'s ' 'checksum. A value of 0 disables the block calculation and the entire ' 'file will be loaded into memory.' diff --git a/mayan/apps/mimetype/literals.py b/mayan/apps/mimetype/literals.py new file mode 100644 index 0000000000..6d082d12c4 --- /dev/null +++ b/mayan/apps/mimetype/literals.py @@ -0,0 +1,3 @@ +from __future__ import unicode_literals + +DEFAULT_MIMETYPE_FILE_READ_SIZE = 1024 diff --git a/mayan/apps/mimetype/settings.py b/mayan/apps/mimetype/settings.py index 1c594d8deb..7b1bd05b72 100644 --- a/mayan/apps/mimetype/settings.py +++ b/mayan/apps/mimetype/settings.py @@ -4,10 +4,13 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.smart_settings import Namespace +from .literals import DEFAULT_MIMETYPE_FILE_READ_SIZE + namespace = Namespace(label=_('MIME type'), name='mimetype') setting_file_read_size = namespace.add_setting( - default=0, global_name='MIMETYPE_FILE_READ_SIZE', help_text=_( + default=DEFAULT_MIMETYPE_FILE_READ_SIZE, + global_name='MIMETYPE_FILE_READ_SIZE', help_text=_( 'Amount of bytes to read from a document to determine its MIME type. ' 'Setting it to 0 disables the feature and attempts to read the entire ' 'document file into memory.'