From 4d7c0552bd780d896507540b1ca88a82fd9105a3 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 22 Jun 2019 00:04:34 -0400 Subject: [PATCH 1/5] Fix help text of the platformtemplate command Signed-off-by: Roberto Rosario --- HISTORY.rst | 1 + docs/releases/3.2.4.rst | 2 +- mayan/apps/platform/management/commands/platformtemplate.py | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index e638e77207..eda8594a63 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,7 @@ ================== * Support configurable GUnicorn timeouts. Defaults to current value of 120 seconds. +* Fix help text of the platformtemplate command. 3.2.3 (2019-06-21) ================== diff --git a/docs/releases/3.2.4.rst b/docs/releases/3.2.4.rst index 3220236ed3..9db3ec8308 100644 --- a/docs/releases/3.2.4.rst +++ b/docs/releases/3.2.4.rst @@ -9,7 +9,7 @@ Changes - Support configurable GUnicorn timeouts. Defaults to current value of 120 seconds. - +- Fix help text of the platformtemplate command. Removals -------- diff --git a/mayan/apps/platform/management/commands/platformtemplate.py b/mayan/apps/platform/management/commands/platformtemplate.py index f76fcc8c7e..3517d5c14a 100644 --- a/mayan/apps/platform/management/commands/platformtemplate.py +++ b/mayan/apps/platform/management/commands/platformtemplate.py @@ -16,7 +16,8 @@ class Command(management.BaseCommand): ) parser.add_argument( '--context', action='store', default='', dest='context', - help='Show a list of available templates.', + help='Pass a context to the template in the form of a JSON encoded ' + 'dictionary.', ) def handle(self, *args, **options): From bdde894765e92f3bf4f6f1618ccb15500d718968 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 27 Jun 2019 08:39:07 -0400 Subject: [PATCH 2/5] [FIX] Remove tag create document registration Make no sense to have the tag create event register to existing tags. Signed-off-by: Roberto Rosario --- mayan/apps/tags/apps.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mayan/apps/tags/apps.py b/mayan/apps/tags/apps.py index ebdca5f970..978dcc1308 100644 --- a/mayan/apps/tags/apps.py +++ b/mayan/apps/tags/apps.py @@ -72,8 +72,7 @@ class TagsApp(MayanAppConfig): ModelEventType.register( model=Tag, event_types=( - event_tag_attach, event_tag_created, event_tag_edited, - event_tag_remove + event_tag_attach, event_tag_edited, event_tag_remove ) ) From 22aa14282b5fad058bbbf64dc524622821fee9cf Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 27 Jun 2019 07:03:55 -0400 Subject: [PATCH 3/5] [Fix] Change to relative imports Signed-off-by: Roberto Rosario --- mayan/apps/tags/workflow_actions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mayan/apps/tags/workflow_actions.py b/mayan/apps/tags/workflow_actions.py index f30e93d2ab..69fccc7337 100644 --- a/mayan/apps/tags/workflow_actions.py +++ b/mayan/apps/tags/workflow_actions.py @@ -6,8 +6,9 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.acls.models import AccessControlList from mayan.apps.document_states.classes import WorkflowAction -from mayan.apps.tags.models import Tag -from mayan.apps.tags.permissions import permission_tag_attach, permission_tag_remove + +from .models import Tag +from .permissions import permission_tag_attach, permission_tag_remove __all__ = ('AttachTagAction', 'RemoveTagAction') logger = logging.getLogger(__name__) From d636174c859300df0b54b698576f337c397ed3ed Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 27 Jun 2019 11:35:58 -0400 Subject: [PATCH 4/5] Add test case database connection check Signed-off-by: Roberto Rosario --- mayan/apps/common/tests/base.py | 14 ++++++++------ mayan/apps/common/tests/mixins.py | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/mayan/apps/common/tests/base.py b/mayan/apps/common/tests/base.py index 3c63cef475..5c08bffd57 100644 --- a/mayan/apps/common/tests/base.py +++ b/mayan/apps/common/tests/base.py @@ -9,16 +9,18 @@ from mayan.apps.permissions.classes import Permission from mayan.apps.smart_settings.classes import Namespace from .mixins import ( - ClientMethodsTestCaseMixin, ContentTypeCheckTestCaseMixin, - ModelTestCaseMixin, OpenFileCheckTestCaseMixin, - RandomPrimaryKeyModelMonkeyPatchMixin, SilenceLoggerTestCaseMixin, - TempfileCheckTestCasekMixin, TestViewTestCaseMixin + ClientMethodsTestCaseMixin, ConnectionsCheckTestCaseMixin, + ContentTypeCheckTestCaseMixin, ModelTestCaseMixin, + OpenFileCheckTestCaseMixin, RandomPrimaryKeyModelMonkeyPatchMixin, + SilenceLoggerTestCaseMixin, TempfileCheckTestCasekMixin, + TestViewTestCaseMixin ) class BaseTestCase( - SilenceLoggerTestCaseMixin, RandomPrimaryKeyModelMonkeyPatchMixin, - ACLTestCaseMixin, ModelTestCaseMixin, OpenFileCheckTestCaseMixin, + SilenceLoggerTestCaseMixin, ConnectionsCheckTestCaseMixin, + RandomPrimaryKeyModelMonkeyPatchMixin, ACLTestCaseMixin, + ModelTestCaseMixin, OpenFileCheckTestCaseMixin, TempfileCheckTestCasekMixin, TestCase ): """ diff --git a/mayan/apps/common/tests/mixins.py b/mayan/apps/common/tests/mixins.py index 1060f9c4ea..afb9501fde 100644 --- a/mayan/apps/common/tests/mixins.py +++ b/mayan/apps/common/tests/mixins.py @@ -12,7 +12,7 @@ from django.apps import apps from django.conf import settings from django.conf.urls import url from django.contrib.contenttypes.models import ContentType -from django.db import connection, models +from django.db import connection, connections, models from django.db.models.signals import post_save, pre_save from django.http import HttpResponse from django.template import Context, Template @@ -80,6 +80,29 @@ class ClientMethodsTestCaseMixin(object): ) +class ConnectionsCheckTestCaseMixin(object): + _open_connections_check_enable = True + + def _get_open_connections_count(self): + return len(connections.all()) + + def setUp(self): + super(ConnectionsCheckTestCaseMixin, self).setUp() + self._connections_count = self._get_open_connections_count() + + def tearDown(self): + if self._open_connections_check_enable: + + self.assertEqual( + self._connections_count, self._get_open_connections_count(), + msg='Database connection leak. The number of database ' + 'connections at the start and at the end of the test are not ' + 'the same.' + ) + + super(ConnectionsCheckTestCaseMixin, self).tearDown() + + class ContentTypeCheckTestCaseMixin(object): expected_content_type = 'text/html; charset=utf-8' From 80065279cba60250353e1e7b5a8e44bf43cec694 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 28 Jun 2019 11:46:49 -0400 Subject: [PATCH 5/5] Fix install typos and missing commands Signed-off-by: Roberto Rosario --- docs/chapters/deploying.rst | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/chapters/deploying.rst b/docs/chapters/deploying.rst index 3a90e44556..425f3274f9 100644 --- a/docs/chapters/deploying.rst +++ b/docs/chapters/deploying.rst @@ -4,7 +4,6 @@ Direct deployments Mayan EDMS should be deployed like any other Django_ project and preferably using virtualenv_. Below are some ways to deploy and use Mayan EDMS. -Do not use more than one method. Being a Django_ and a Python_ project, familiarity with these technologies is recommended to better understand why Mayan EDMS does some of the things it @@ -38,7 +37,7 @@ For another setup that offers more performance and scalability refer to the Platforms with the ARM CPU might also need additional requirements. :: - apt-sudo get libffi-dev libssl-dev -y + sudo apt-get install libffi-dev libssl-dev -y 2. Create the user account for the installation: @@ -149,7 +148,7 @@ For another setup that offers more performance and scalability refer to the ------------------------------------------------------------------------ :: - MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \ + sudo MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan \ MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan \ MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=/opt/mayan-edms/media \ /opt/mayan-edms/bin/mayan-edms.py platformtemplate supervisord > /etc/supervisor/conf.d/mayan.conf @@ -161,17 +160,17 @@ For another setup that offers more performance and scalability refer to the database and only keep 1 database: :: - echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf - echo "save \"\"" >> /etc/redis/redis.conf - echo "databases 1" >> /etc/redis/redis.conf - systemctl restart redis + sudo echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf + sudo echo "save \"\"" >> /etc/redis/redis.conf + sudo echo "databases 1" >> /etc/redis/redis.conf + sudo systemctl restart redis 13. Enable and restart the services [1_]: ----------------------------------------- :: - systemctl enable supervisor - systemctl restart supervisor + sudo systemctl enable supervisor + sudo systemctl restart supervisor 14. Cleaning up: @@ -180,7 +179,7 @@ For another setup that offers more performance and scalability refer to the installation and can be removed. :: - apt-get remove --purge libjpeg-dev libpq-dev libpng-dev libtiff-dev zlib1g-dev + sudo apt-get remove --purge libjpeg-dev libpq-dev libpng-dev libtiff-dev zlib1g-dev .. _deployment_advanced: @@ -227,7 +226,7 @@ of a restart or power failure. The Gunicorn workers are increased to 3. with:: - MAYAN_BROKER_URL="amqp://mayan:mayanuserpass@localhost:5672/mayan", + MAYAN_BROKER_URL="amqp://mayan:mayanrabbitmqpassword@localhost:5672/mayan", increase the number of Gunicorn workers to 3 in the line (``-w 2`` section):: @@ -240,7 +239,7 @@ of a restart or power failure. The Gunicorn workers are increased to 3. ------------------------ :: - supervisorctl restart all + sudo supervisorctl restart all