From 048960ae52132b9206373a8e854e80aac7d978af Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 13:51:39 -0400 Subject: [PATCH 1/8] Fix ACL create view HTML response type. GitLab issue #335. Thanks to @DocCyblade for the report. --- HISTORY.rst | 1 + docs/releases/2.1.5.rst | 3 +++ mayan/apps/acls/tests/test_views.py | 31 ++++++++++++++++++++++++++++- mayan/apps/acls/views.py | 10 +++++----- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 540ac20a12..394b02e54f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,7 @@ - Backport zoom transformation performance improvement (GitLab #334). - Backport trash can navigation link resolution fix (GitLab #331). - Improve documentation regarding the use of GPG version 1 (GitLab #333). +- Fix ACL create view HTML response type. (GitLab #335). 2.1.4 (2016-10-28) ================== diff --git a/docs/releases/2.1.5.rst b/docs/releases/2.1.5.rst index 4a75e8fd18..93105f83ff 100644 --- a/docs/releases/2.1.5.rst +++ b/docs/releases/2.1.5.rst @@ -21,6 +21,7 @@ Other changes - Backport zoom performance improvement (GitLab #334). - Backport trash can navigation link resolution fix (GitLab #331). - Improve documentation regarding the use of GPG version 1 (GitLab #333). +- Fix ACL create view HTML response type. (GitLab #335). Removals -------- @@ -79,5 +80,7 @@ Bugs fixed or issues closed * `GitLab issue #331 `_ Trash List View: Items actions should be limited * `GitLab issue #333 `_ "Unable to run gpg - it may not be available." * `GitLab issue #334 `_ Perfomance improvment: prevent unnecessary image.resize in TransformationZoom +* `GitLab issue #335 `_ Wrong HTML Content-Type in ACL->NEW + .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/acls/tests/test_views.py b/mayan/apps/acls/tests/test_views.py index 58dfb936b4..556c0f3738 100644 --- a/mayan/apps/acls/tests/test_views.py +++ b/mayan/apps/acls/tests/test_views.py @@ -26,7 +26,7 @@ class AccessControlListViewTestCase(GenericDocumentViewTestCase): def test_acl_create_view_no_permission(self): self.login(username=TEST_USER_USERNAME, password=TEST_USER_PASSWORD) - response = self.post( + response = self.get( viewname='acls:acl_create', kwargs=self.view_arguments, data={ 'role': self.role.pk } @@ -42,6 +42,35 @@ class AccessControlListViewTestCase(GenericDocumentViewTestCase): permission_acl_edit.stored_permission ) + response = self.get( + viewname='acls:acl_create', kwargs=self.view_arguments, data={ + 'role': self.role.pk + }, follow=True + ) + + self.assertContains( + response, text=self.document.label, status_code=200 + ) + + def test_acl_create_view_post_no_permission(self): + self.login(username=TEST_USER_USERNAME, password=TEST_USER_PASSWORD) + + response = self.post( + viewname='acls:acl_create', kwargs=self.view_arguments, data={ + 'role': self.role.pk + } + ) + + self.assertEquals(response.status_code, 403) + self.assertEqual(AccessControlList.objects.count(), 0) + + def test_acl_create_view_with_post_permission(self): + self.login(username=TEST_USER_USERNAME, password=TEST_USER_PASSWORD) + + self.role.permissions.add( + permission_acl_edit.stored_permission + ) + response = self.post( viewname='acls:acl_create', kwargs=self.view_arguments, data={ 'role': self.role.pk diff --git a/mayan/apps/acls/views.py b/mayan/apps/acls/views.py index 2ee1228f20..0d1795d058 100644 --- a/mayan/apps/acls/views.py +++ b/mayan/apps/acls/views.py @@ -29,16 +29,16 @@ class ACLCreateView(SingleObjectCreateView): model = AccessControlList def dispatch(self, request, *args, **kwargs): - self.content_type = get_object_or_404( + self.object_content_type = get_object_or_404( ContentType, app_label=self.kwargs['app_label'], model=self.kwargs['model'] ) try: - self.content_object = self.content_type.get_object_for_this_type( + self.content_object = self.object_content_type.get_object_for_this_type( pk=self.kwargs['object_id'] ) - except self.content_type.model_class().DoesNotExist: + except self.object_content_type.model_class().DoesNotExist: raise Http404 try: @@ -60,7 +60,7 @@ class ACLCreateView(SingleObjectCreateView): def form_valid(self, form): try: acl = AccessControlList.objects.get( - content_type=self.content_type, + content_type=self.object_content_type, object_id=self.content_object.pk, role=form.cleaned_data['role'] ) @@ -130,7 +130,7 @@ class ACLListView(SingleObjectListView): self.content_object = self.object_content_type.get_object_for_this_type( pk=self.kwargs['object_id'] ) - except self.content_type.model_class().DoesNotExist: + except self.object_content_type.model_class().DoesNotExist: raise Http404 try: From e4a4e6b0c892fd051a6d56fd4f90302655820744 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 17:47:00 -0400 Subject: [PATCH 2/8] Don't open a new browser window when running makefile commands. --- Makefile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Makefile b/Makefile index f2513c0b07..c9dc8bc30e 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,5 @@ .PHONY: clean-pyc clean-build -define BROWSER_PYSCRIPT -import sys, webbrowser -webbrowser.open(sys.argv[1]) -endef -export BROWSER_PYSCRIPT -BROWSER := python -c "$$BROWSER_PYSCRIPT" - help: @echo @@ -62,7 +55,6 @@ test-all: # Documentation docs_serve: - $(BROWSER) http://127.0.0.1:8000 cd docs;make livehtml @@ -110,7 +102,6 @@ wheel: clean # Dev server runserver: - $(BROWSER) http://127.0.0.1:8000 ./manage.py runserver shell_plus: From 98327ae877df33bf8accd4bd955ba04f1d6b898c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 17:47:51 -0400 Subject: [PATCH 3/8] Return the same image when rotation degrees are 0. --- mayan/apps/converter/classes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mayan/apps/converter/classes.py b/mayan/apps/converter/classes.py index 74388e13d0..9580d42ad9 100644 --- a/mayan/apps/converter/classes.py +++ b/mayan/apps/converter/classes.py @@ -296,6 +296,12 @@ class TransformationRotate(BaseTransformation): def execute_on(self, *args, **kwargs): super(TransformationRotate, self).execute_on(*args, **kwargs) + + self.degrees %= 360 + + if self.degress == 0: + return self.image + return self.image.rotate( 360 - self.degrees, resample=Image.BICUBIC, expand=True ) From 95a23c8f7a5d0c92f12f6a45375f4648957d51ba Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 18:03:10 -0400 Subject: [PATCH 4/8] Expland staging folder and watch folder explanation. --- docs/topics/sources.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/topics/sources.rst b/docs/topics/sources.rst index 597a5d8a6a..b4e720d366 100644 --- a/docs/topics/sources.rst +++ b/docs/topics/sources.rst @@ -9,9 +9,6 @@ The current document sources supported are: - Web - ``HTML`` forms with a ``Browse`` button that will open the file dialog when clicked to allow selection of files in the user's computer to be uploaded as documents. -- Staging folder - Folder where networked attached scanned can save image - files. The files in these staging folders are scanned and a preview is - generated to help the process of upload. - POP3 email - Provide the email, server and credential of a ``POP3`` based email to be scanned periodically for email. The body of the email is uploaded as a document and the attachments of the email are uploaded as separate @@ -20,6 +17,19 @@ The current document sources supported are: the ``IMAP`` protocol. - Watch folder - A filesystem folder that is scanned periodically for files. Any file in the watch folder is automatically uploaded. +- Staging folder - Folder where networked attached scanned can save image + files. The files in these staging folders are scanned and a preview is + generated to help the process of upload. Staging folders and Watch folders + work in a similar way with the main difference being that Staging folders are + interactive while Watch folders are automatic; documents in a Watch folder + are uploaded periodically and documents in a Staging folder remain indefinitely + there until an user uploads them. A preview for files in a Staging folder is + also provided. An example of Staging folder use is when multiple people + are scanning documents but only one person must be allowed to upload those + documents. This one person examines the scans quality and decides what to + upload and what to reject and have re-scanned. Watch folders can be used + when the quality of the scans is irrelevant or when they will be known + to be of good quality, such as when receiving e-faxes as PDFs. Document source can be configure to allow document bundles to uploaded as compressed files which are decompressed and their content uploaded as separate From 7f4dee8d69547e03a69be223d4163429f926977c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 18:19:49 -0400 Subject: [PATCH 5/8] Fix testing settings for GitLab CI. --- mayan/settings/testing/gitlab-ci/__init__.py | 2 +- mayan/settings/testing/gitlab-ci/base.py | 5 +++++ mayan/settings/testing/gitlab-ci/db_mysql.py | 2 +- mayan/settings/testing/gitlab-ci/db_postgres.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 mayan/settings/testing/gitlab-ci/base.py diff --git a/mayan/settings/testing/gitlab-ci/__init__.py b/mayan/settings/testing/gitlab-ci/__init__.py index 52dd3067e9..46fb87a6c1 100644 --- a/mayan/settings/testing/gitlab-ci/__init__.py +++ b/mayan/settings/testing/gitlab-ci/__init__.py @@ -1,4 +1,4 @@ -from ..base import * # NOQA +from .base import * # NOQA SIGNATURES_GPG_PATH = '/usr/bin/gpg1' diff --git a/mayan/settings/testing/gitlab-ci/base.py b/mayan/settings/testing/gitlab-ci/base.py new file mode 100644 index 0000000000..eb890b44b0 --- /dev/null +++ b/mayan/settings/testing/gitlab-ci/base.py @@ -0,0 +1,5 @@ +from __future__ import unicode_literals + +from ..base import * # NOQA + +SIGNATURES_GPG_PATH = '/usr/bin/gpg1' diff --git a/mayan/settings/testing/gitlab-ci/db_mysql.py b/mayan/settings/testing/gitlab-ci/db_mysql.py index 00a9050121..6792c95e34 100644 --- a/mayan/settings/testing/gitlab-ci/db_mysql.py +++ b/mayan/settings/testing/gitlab-ci/db_mysql.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from ..base import * # NOQA +from .base import * # NOQA DATABASES = { 'default': { diff --git a/mayan/settings/testing/gitlab-ci/db_postgres.py b/mayan/settings/testing/gitlab-ci/db_postgres.py index bf0ff1d380..fb763595d9 100644 --- a/mayan/settings/testing/gitlab-ci/db_postgres.py +++ b/mayan/settings/testing/gitlab-ci/db_postgres.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from ..base import * # NOQA +from .base import * # NOQA DATABASES = { 'default': { From df3f7c38c36e5a9e69a869f1dd58ce7817fc8b97 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 19:23:06 -0400 Subject: [PATCH 6/8] Update changelog and release notes. --- HISTORY.rst | 3 ++- docs/releases/2.1.5.rst | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 394b02e54f..e22de3c9e2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,4 +1,4 @@ -2.1.5 (2016-xx-xx) +2.1.5 (2016-11-xx) ================== - Backport resize transformation math operation fix (GitLab #319). - Update Pillow to 3.1.2 (Security fix). @@ -6,6 +6,7 @@ - Backport trash can navigation link resolution fix (GitLab #331). - Improve documentation regarding the use of GPG version 1 (GitLab #333). - Fix ACL create view HTML response type. (GitLab #335). +- Expland staging folder and watch folder explanation. 2.1.4 (2016-10-28) ================== diff --git a/docs/releases/2.1.5.rst b/docs/releases/2.1.5.rst index 93105f83ff..149a68efad 100644 --- a/docs/releases/2.1.5.rst +++ b/docs/releases/2.1.5.rst @@ -2,7 +2,7 @@ Mayan EDMS v2.1.5 release notes =============================== -Released: XX, 2016 +Released: November XX, 2016 What's new ========== @@ -22,6 +22,7 @@ Other changes - Backport trash can navigation link resolution fix (GitLab #331). - Improve documentation regarding the use of GPG version 1 (GitLab #333). - Fix ACL create view HTML response type. (GitLab #335). +- Expland staging folder and watch folder explanation. Removals -------- From 1867b2e08dc9781b9baa8a30c60155cf05115721 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 19:59:05 -0400 Subject: [PATCH 7/8] Update release notes and changelog. --- HISTORY.rst | 2 +- docs/releases/2.1.5.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index e22de3c9e2..aece785e9c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,4 +1,4 @@ -2.1.5 (2016-11-xx) +2.1.5 (2016-11-08) ================== - Backport resize transformation math operation fix (GitLab #319). - Update Pillow to 3.1.2 (Security fix). diff --git a/docs/releases/2.1.5.rst b/docs/releases/2.1.5.rst index 149a68efad..023397cec6 100644 --- a/docs/releases/2.1.5.rst +++ b/docs/releases/2.1.5.rst @@ -2,7 +2,7 @@ Mayan EDMS v2.1.5 release notes =============================== -Released: November XX, 2016 +Released: November 8, 2016 What's new ========== From 9c0d2ac60cd426c6d4bb6c2c7deb9cf02c15e100 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 20:00:26 -0400 Subject: [PATCH 8/8] Bump version to 2.1.5 --- mayan/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mayan/__init__.py b/mayan/__init__.py index 188ec8ef38..cd921cfcd8 100644 --- a/mayan/__init__.py +++ b/mayan/__init__.py @@ -1,8 +1,8 @@ from __future__ import unicode_literals __title__ = 'Mayan EDMS' -__version__ = '2.1.4' -__build__ = 0x020103 +__version__ = '2.1.5' +__build__ = 0x020105 __author__ = 'Roberto Rosario' __author_email__ = 'roberto.rosario@mayan-edms.com' __description__ = 'Free Open Source Electronic Document Management System'