build
dist
.idea/
+.coverage
+.eggs
+.tox
+++ /dev/null
-language: python
-python:
- - "2.7"
- - "3.2"
- - "3.3"
- - "3.4"
- - "3.5"
-env:
- matrix:
- - DJANGO_VERSION=1.2
- - DJANGO_VERSION=1.3
- - DJANGO_VERSION=1.4
- - DJANGO_VERSION=1.5
- - DJANGO_VERSION=1.6
- - DJANGO_VERSION=1.7
- - DJANGO_VERSION=1.8
- - DJANGO_VERSION=1.9
-install:
- - pip install 'coverage<4' # coverage>=4 has issues with python3
- - pip install -q Django==$DJANGO_VERSION coveralls
- - python setup.py egg_info
-script: coverage run --source='fnp_django_pagination' --omit *runner*,*test_project* setup.py test
-after_success:
- - coveralls
-matrix:
- include:
- - python: "2.6"
- env: DJANGO_VERSION=1.4
- - python: "2.6"
- env: DJANGO_VERSION=1.5
- - python: "2.6"
- env: DJANGO_VERSION=1.6
- exclude:
- - python: "3.2"
- env: DJANGO_VERSION=1.2 # Unsupported
- - python: "3.2"
- env: DJANGO_VERSION=1.3 # Unsupported
- - python: "3.2"
- env: DJANGO_VERSION=1.4 # Unsupported
- - python: "3.2"
- env: DJANGO_VERSION=1.9 # Unsupported
- - python: "3.3"
- env: DJANGO_VERSION=1.9 # ImportError: cannot import name find_spec
- - python: "3.3"
- env: DJANGO_VERSION=1.2 # Unsupported
- - python: "3.3"
- env: DJANGO_VERSION=1.3 # Unsupported
- - python: "3.3"
- env: DJANGO_VERSION=1.4 # Unsupported
- - python: "3.4"
- env: DJANGO_VERSION=1.2 # Unsupported
- - python: "3.4"
- env: DJANGO_VERSION=1.3 # Unsupported
- - python: "3.4"
- env: DJANGO_VERSION=1.4 # Unsupported
- - python: "3.5"
- env: DJANGO_VERSION=1.2 # Unsupported
- - python: "3.5"
- env: DJANGO_VERSION=1.3 # Unsupported
- - python: "3.5"
- env: DJANGO_VERSION=1.4 # Unsupported
- - python: "3.5"
- env: DJANGO_VERSION=1.5 # Unsupported
- - python: "3.5"
- env: DJANGO_VERSION=1.7 # AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
- - python: "3.5"
- env: DJANGO_VERSION=1.6 # AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
"""
-__version__ = (2, 2, 2, "final", 0)
+__version__ = (2, 2, 3, "final", 0)
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from django.utils.deprecation import MiddlewareMixin
+
def get_page(self, suffix):
"""
return 1
-class PaginationMiddleware(object):
+class PaginationMiddleware(MiddlewareMixin):
"""
Inserts a variable representing the current page onto the request object if
it exists in either **GET** or **POST** portions of the request.
super(InfinitePaginator, self).__init__(object_list, per_page, orphans,
allow_empty_first_page)
# no count or num pages
- del self._num_pages, self._count
+ try:
+ del self._num_pages, self._count
+ except AttributeError:
+ # These are just cached properties anyway.
+ pass
# bonus links
self.link_template = link_template
)
try:
- from django.template.base import TOKEN_BLOCK
-except ImportError: # Django < 1.8
- from django.template import TOKEN_BLOCK
+ from django.template.base import TokenType
+ TOKEN_BLOCK = TokenType.BLOCK
+except ImportError:
+ try:
+ # Django 1.8-1.11
+ from django.template.base import TOKEN_BLOCK
+ except ImportError: # Django < 1.8
+ from django.template import TOKEN_BLOCK
from django.template.loader import select_template
from django.utils.text import unescape_string_literal
INSTALLED_APPS = (
'fnp_django_pagination',
)
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ },
+]
--- /dev/null
+# This file is part of django-ssify, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See README.md for more information.
+#
+[tox]
+envlist=clear,
+ d{12,13,14}-py27,
+ d{15}-py{27,32},
+ d16-py{27,32,33},
+ d17-py{27,32,33,34},
+ d18-py{27,32,33,34},
+ d{19,110}-py{27,34,35},
+ d111-py{27,34,35,36,37},
+ d20-py{34,35,36,37},
+ d{21,22}-py{35,36,37},
+ stats
+
+[testenv]
+indexserver=https://py.mdrn.pl:8443
+commands=coverage run --source=fnp_django_pagination --omit *runner*,*test_project* setup.py test
+deps=
+ d12: Django>=1.2,<1.3
+ d13: Django>=1.3,<1.4
+ d14: Django>=1.4,<1.5
+ d15: Django>=1.5,<1.6
+ d16: Django>=1.6,<1.7
+ d17: Django>=1.7,<1.8
+ d18: Django>=1.8,<1.9
+ d19: Django>=1.9,<1.10
+ d110: Django>=1.10,<1.11
+ d111: Django>=1.11,<2.0
+ d20: Django>=2.0,<2.1
+ d21: Django>=2.1,<2.2
+ d22: Django>=2.2,<2.3
+ coverage
+
+[testenv:clear]
+basepython=python3.4
+commands=coverage erase
+
+[testenv:stats]
+basepython=python3.4
+commands=coverage html