diff --git a/HISTORY.rst b/HISTORY.rst index ac1064d81e..72b23a9b5c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,4 +1,4 @@ -2.2.1 (2017-05-25) +2.2.1 (2017-05-XX) ================== - Allow for bigger indexing expression templates. - Auto select checkbox when updating metadata values. GitLab issue #371. @@ -9,6 +9,7 @@ - Rewrite document indexing code to be faster and use less locking. - Use a predefined file path for the file lock. - Catch documents with not document version when displaying their thumbnails. +- Document page navigation fix when using Mayan as a sub URL app. 2.2 (2017-04-26) ================ diff --git a/docs/releases/2.2.1.rst b/docs/releases/2.2.1.rst index 6ae60a1982..2f545f7eb3 100644 --- a/docs/releases/2.2.1.rst +++ b/docs/releases/2.2.1.rst @@ -22,9 +22,15 @@ Changes About menu. - Add support for rebuilding specific indexes instead of only being able to rebuild all index. -- Rewrite document indexing code to be faster and use less locking. +- Rewrite document indexing code to be faster and use less locking. Thanks to + Macrobb Simpson (@Macrobb) for the initial implementation. - Use a predefined file path for the file lock. - Catch documents with not document version when displaying their thumbnails. +- Add custom script_prefix aware resolve function and use it for the + document page navigation views. Fixes an issue when Mayan is installed + as a sub URL app. Thanks to Gustavo Teixeira(@gsteixei) for the issue and + investigation. + Removals -------- @@ -80,6 +86,7 @@ Bugs fixed or issues closed =========================== * `GitLab issue #371 `_ Auto select checkbox when updating metadata +* `GitLab issue #383 `_ Page not found when deployed to sub-uri * `GitLab issue #385 `_ mountindex: how to specify FUSE mount option allow_other? .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/common/utils.py b/mayan/apps/common/utils.py index 1ef8f55199..fb006f6d57 100644 --- a/mayan/apps/common/utils.py +++ b/mayan/apps/common/utils.py @@ -8,6 +8,8 @@ import types import xmlrpclib from django.conf import settings +from django.core.urlresolvers import resolve as django_resolve +from django.urls.base import get_script_prefix from django.utils.datastructures import MultiValueDict from django.utils.http import urlquote as django_urlquote from django.utils.http import urlencode as django_urlencode @@ -108,6 +110,11 @@ def mkstemp(*args, **kwargs): return tempfile.mkstemp(*args, **kwargs) +def resolve(path, urlconf=None): + path = '/{}'.format(path.replace(get_script_prefix(), '', 1)) + return django_resolve(path=path, urlconf=urlconf) + + def return_attrib(obj, attrib, arguments=None): try: if isinstance(attrib, types.FunctionType): diff --git a/mayan/apps/documents/views/document_page_views.py b/mayan/apps/documents/views/document_page_views.py index 45de60424b..48adda867c 100644 --- a/mayan/apps/documents/views/document_page_views.py +++ b/mayan/apps/documents/views/document_page_views.py @@ -5,7 +5,7 @@ import urlparse from django.conf import settings from django.contrib import messages -from django.core.urlresolvers import resolve, reverse +from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 from django.utils.http import urlencode from django.utils.translation import ugettext_lazy as _ @@ -13,6 +13,7 @@ from django.views.generic import RedirectView from acls.models import AccessControlList from common.generics import SimpleView, SingleObjectListView +from common.utils import resolve from converter.literals import DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL from ..forms import DocumentPageForm