Renamed PageNoOutOfRangeError to PageNoOutOfRangeException.
This commit is contained in:
parent
5ff7f444e9
commit
df0380362b
@ -32,7 +32,7 @@ from accounting.utils import PeriodParser
|
|||||||
from mia import settings
|
from mia import settings
|
||||||
from mia_core.digest_auth import digest_login_required
|
from mia_core.digest_auth import digest_login_required
|
||||||
from mia_core.utils import UrlBuilder, Pagination, \
|
from mia_core.utils import UrlBuilder, Pagination, \
|
||||||
PageNoOutOfRangeError
|
PageNoOutOfRangeException
|
||||||
|
|
||||||
|
|
||||||
@require_GET
|
@require_GET
|
||||||
@ -114,7 +114,7 @@ class BaseReportView(generic.ListView):
|
|||||||
try:
|
try:
|
||||||
r = super(BaseReportView, self) \
|
r = super(BaseReportView, self) \
|
||||||
.get(request, *args, **kwargs)
|
.get(request, *args, **kwargs)
|
||||||
except PageNoOutOfRangeError:
|
except PageNoOutOfRangeException:
|
||||||
return HttpResponseRedirect(
|
return HttpResponseRedirect(
|
||||||
str(UrlBuilder(request.get_full_path())
|
str(UrlBuilder(request.get_full_path())
|
||||||
.del_param("page")))
|
.del_param("page")))
|
||||||
|
@ -157,15 +157,15 @@ class Pagination:
|
|||||||
total_pages = int((count - 1) / self.page_size) + 1
|
total_pages = int((count - 1) / self.page_size) + 1
|
||||||
default_page = 1 if not is_reverse else total_pages
|
default_page = 1 if not is_reverse else total_pages
|
||||||
if page_no == default_page:
|
if page_no == default_page:
|
||||||
raise PageNoOutOfRangeError()
|
raise PageNoOutOfRangeException()
|
||||||
self.page_no = page_no \
|
self.page_no = page_no \
|
||||||
if page_no is not None \
|
if page_no is not None \
|
||||||
else default_page
|
else default_page
|
||||||
if self.page_no > total_pages:
|
if self.page_no > total_pages:
|
||||||
raise PageNoOutOfRangeError()
|
raise PageNoOutOfRangeException()
|
||||||
|
|
||||||
|
|
||||||
class PageNoOutOfRangeError(Exception):
|
class PageNoOutOfRangeException(Exception):
|
||||||
"""The error thrown when the specified page number is out of
|
"""The error thrown when the specified page number is out of
|
||||||
range.
|
range.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user