Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-django-request for
openSUSE:Factory checked in at 2022-02-25 21:25:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-request (Old)
and /work/SRC/openSUSE:Factory/.python-django-request.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-django-request"
Fri Feb 25 21:25:08 2022 rev:2 rq:957473 version:1.6.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-django-request/python-django-request.changes
2020-09-15 16:29:36.570672576 +0200
+++
/work/SRC/openSUSE:Factory/.python-django-request.new.1958/python-django-request.changes
2022-02-25 21:25:38.491644408 +0100
@@ -1,0 +2,15 @@
+Fri Feb 25 04:51:19 UTC 2022 - Steve Kowalik <[email protected]>
+
+- Update to 1.6.0:
+ * Support for Django 1.11, 2.0, 2.1, 3.0, and 3.1 has been dropped.
+ * Support for Python 2.7 and 3.4 has been dropped.
+ * Adds htmx support to the REQUEST_IGNORE_AJAX setting.
+ * Confirms support for Django 4.0.
+ * Confirms support for Django 3.2.
+ * Confirms support for Python 3.10.
+ * Confirms support for Python 3.9.
+- Drop six from {Build,}Requires.
+- Add patch set-timezone-for-day-tests.patch:
+ * Set overridden timezone.
+
+-------------------------------------------------------------------
Old:
----
django-request-1.5.6.tar.gz
New:
----
django-request-1.6.0.tar.gz
set-timezone-for-day-tests.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-django-request.spec ++++++
--- /var/tmp/diff_new_pack.Luibq2/_old 2022-02-25 21:25:39.151644526 +0100
+++ /var/tmp/diff_new_pack.Luibq2/_new 2022-02-25 21:25:39.155644527 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-django-request
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,27 +16,26 @@
#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%{?!python_module:%define python_module() python3-%{**}}
Name: python-django-request
-Version: 1.5.6
+Version: 1.6.0
Release: 0
Summary: Django statistics app
License: BSD-2-Clause
-Group: Development/Languages/Python
URL: https://github.com/django-request/django-request
Source:
https://github.com/django-request/django-request/archive/%{version}.tar.gz#/django-request-%{version}.tar.gz
+# gh#django-request/django-request#241
+Patch0: set-timezone-for-day-tests.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-Django >= 1.11
+Requires: python-Django >= 2.2
Requires: python-python-dateutil
-Requires: python-six
BuildArch: noarch
# SECTION test requirements
-BuildRequires: %{python_module Django >= 1.11}
BuildRequires: %{python_module mock}
+BuildRequires: %{python_module Django >= 2.2}
BuildRequires: %{python_module python-dateutil}
-BuildRequires: %{python_module six}
# /SECTION
%python_subpackages
@@ -46,7 +45,7 @@
it can also be used to get statistics on who is online etc.
%prep
-%setup -q -n django-request-%{version}
+%autosetup -p1 -n django-request-%{version}
%build
%python_build
++++++ django-request-1.5.6.tar.gz -> django-request-1.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/.github/workflows/tests.yml
new/django-request-1.6.0/.github/workflows/tests.yml
--- old/django-request-1.5.6/.github/workflows/tests.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/django-request-1.6.0/.github/workflows/tests.yml 2021-12-20
20:35:50.000000000 +0100
@@ -0,0 +1,56 @@
+---
+name: Tests
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+
+jobs:
+ tests:
+ name: Python ${{ matrix.python-version }}
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version:
+ - '3.6'
+ - '3.7'
+ - '3.8'
+ - '3.9'
+ - '3.10'
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip setuptools coveralls tox>=2.1
+ - name: Run tox targets for ${{ matrix.python-version }}
+ run: |
+ ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
+ TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',')
python -m tox
+
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.10'
+ - name: Ensure latest setuptools
+ run: |
+ python -m pip install --upgrade pip setuptools
+ - name: Install dependencies
+ run: |
+ python -m pip install tox
+ - name: Run tox
+ run: |
+ python -m pip --version
+ python -m tox --version
+ python -m tox -e isort,flake
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/.travis.yml
new/django-request-1.6.0/.travis.yml
--- old/django-request-1.5.6/.travis.yml 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/.travis.yml 1970-01-01 01:00:00.000000000
+0100
@@ -1,69 +0,0 @@
-os: linux
-dist: xenial
-language: python
-jobs:
- include:
- - python: '2.7'
- env: TOXENV=py27-django111-test
- - python: '3.4'
- env: TOXENV=py34-django111-test
- - python: '3.4'
- env: TOXENV=py34-django20-test
- - python: '3.6'
- env: TOXENV=py36-django111-test
- - python: '3.6'
- env: TOXENV=py36-django20-test
- - python: '3.6'
- env: TOXENV=py36-django21-test
- - python: '3.6'
- env: TOXENV=py36-django22-test
- - python: '3.6'
- env: TOXENV=py36-django30-test
- - python: '3.6'
- env: TOXENV=py36-django31-test
- - python: '3.6'
- env: TOXENV=py36-djangomaster-test
- - python: '3.7'
- env: TOXENV=py37-django111-test
- - python: '3.7'
- env: TOXENV=py37-django20-test
- - python: '3.7'
- env: TOXENV=py37-django21-test
- - python: '3.7'
- env: TOXENV=py37-django22-test
- - python: '3.7'
- env: TOXENV=py37-django30-test
- - python: '3.7'
- env: TOXENV=py37-django31-test
- - python: '3.7'
- env: TOXENV=py37-djangomaster-test
- - python: '3.8'
- env: TOXENV=py38-django22-test
- - python: '3.8'
- env: TOXENV=py38-django30-test
- - python: '3.8'
- env: TOXENV=py38-django31-test
- - python: '3.8'
- env: TOXENV=py38-djangomaster-test
- - python: '3.8'
- env: TOXENV=isort
- - python: '3.8'
- env: TOXENV=flake
- allow_failures:
- - env: TOXENV=py36-djangomaster-test
- - env: TOXENV=py37-djangomaster-test
- - env: TOXENV=py38-djangomaster-test
-install:
-- pip install coveralls tox>=2.1
-script:
-- tox
-after_script:
-- coveralls
-deploy:
- provider: pypi
- username: djangorequest
- password:
- secure:
ihSODos3XjtALjVY8qVDjIeFHfmxjgwABjMmlod4f7IVwf7bST7NLqG0JKPquesNx8mt+1IWdRSTbPKXmhSUqFrgqLts6jKfmj9vtAKKKnKcfNfe548NMC5D5FsYPpRRzX1idUpHxr3O/vo10P2DoQ+b88spmCK/irAtAXvdqd8=
- distributions: sdist bdist_wheel
- on:
- tags: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/CHANGELOG.md
new/django-request-1.6.0/CHANGELOG.md
--- old/django-request-1.5.6/CHANGELOG.md 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/CHANGELOG.md 2021-12-20 20:35:50.000000000
+0100
@@ -1,5 +1,30 @@
# Changelog for django-request
+## 1.6.0
+
+### Breaking
+
+* Support for Django 1.11, 2.0, 2.1, 3.0, and 3.1 has been dropped.
+
+* Support for Python 2.7 and 3.4 has been dropped.
+
+### Enhancements
+
+* Adds [htmx](https://htmx.org/) support to the ``REQUEST_IGNORE_AJAX``
+ setting.
+
+* Confirms support for Django 4.0.
+
+* Confirms support for Django 3.2.
+
+* Confirms support for Python 3.10.
+
+* Confirms support for Python 3.9.
+
+### Bug Fixes
+
+* Fixes middleware crash on invalid IP addresses in ``REMOTE_ADDR``.
+
## 1.5.6.
### Breaking
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/LICENSE
new/django-request-1.6.0/LICENSE
--- old/django-request-1.5.6/LICENSE 2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/LICENSE 2021-12-20 20:35:50.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2009-2020, Kyle Fuller and Mariusz Felisiak
+Copyright (c) 2009-2021, Kyle Fuller and Mariusz Felisiak
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/README.md
new/django-request-1.6.0/README.md
--- old/django-request-1.5.6/README.md 2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/README.md 2021-12-20 20:35:50.000000000 +0100
@@ -1,7 +1,7 @@
django-request
==============
-[](https://travis-ci.org/django-request/django-request)
+[](https://github.com/django-request/django-request/actions)
[](https://coveralls.io/github/django-request/django-request?branch=master)
[](https://pypi.org/project/django-request/)
@@ -18,24 +18,32 @@
Requirements
------------
-* **Python**: 2.7, 3.4, 3.6, 3.7, 3.8
-* **Django**: 1.11, 2.0, 2.1, 2.2, 3.0, 3.1
+* **Python**: 3.6, 3.7, 3.8, 3.9, 3.10
+* **Django**: 2.2, 3.2, 4.0
* **python-dateutil**
-* **six**
django-request [1.5.1](https://pypi.org/project/django-request/1.5.1/) is the
last version that supports Django 1.4, 1.5, 1.6.
+
django-request [1.5.4](https://pypi.org/project/django-request/1.5.4/) is the
last version that supports Django 1.7, 1.8, 1.9.
+
django-request [1.5.5](https://pypi.org/project/django-request/1.5.5/) is the
last version that supports Django 1.10.
+django-request [1.5.6](https://pypi.org/project/django-request/1.5.5/) is the
+last version that supports Django 1.11, 2.0, 2.1, 3.0, 3.1, and Python 2.7 and
+3.4.
+
Installation
------------
- Put `'request'` in your `INSTALLED_APPS` setting.
- Run the command `manage.py migrate`.
- Add `request.middleware.RequestMiddleware` to `MIDDLEWARE`. If you use
`django.contrib.auth.middleware.AuthenticationMiddleware`, place the
`RequestMiddleware` after it. If you use
`django.contrib.flatpages.middleware.FlatpageFallbackMiddleware` place
`request.middleware.RequestMiddleware` before it else flatpages will be marked
as error pages in the admin panel.
-- Make sure that the domain name in `django.contrib.sites` admin is correct.
This is used to calculate unique visitors and top referrers.
+- Add `REQUEST_BASE_URL` to your settings with the base URL of your site (e.g.
+ `https://www.my.site/`). This is used to calculate unique visitors and top
+ referrers. `REQUEST_BASE_URL` defaults to
+ `'http://%s' % Site.objects.get_current().domain`.
Detailed documentation
----------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/docs/index.txt
new/django-request-1.6.0/docs/index.txt
--- old/django-request-1.5.6/docs/index.txt 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/docs/index.txt 2021-12-20 20:35:50.000000000
+0100
@@ -26,7 +26,10 @@
#. Add ``request.middleware.RequestMiddleware`` to ``MIDDLEWARE``. If you
use ``django.contrib.auth.middleware.AuthenticationMiddleware``, place
``RequestMiddleware`` after it. If you use
``django.contrib.flatpages.middleware.FlatpageFallbackMiddleware`` place
``request.middleware.RequestMiddleware`` before it else flatpages will be
marked as error pages in the admin panel.
- #. Make sure that the domain name in django.contrib.sites admin is
correct. This is used to calculate unique visitors and top referrers.
+ #. Add ``REQUEST_BASE_URL`` to your settings with the base URL of your site
+ (e.g. ``https://www.my.site/``). This is used to calculate unique
+ visitors and top referrers. ``REQUEST_BASE_URL`` defaults to
+ ``'http://%s' % Site.objects.get_current().domain``.
django-admin.py
===============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/docs/settings.txt
new/django-request-1.6.0/docs/settings.txt
--- old/django-request-1.5.6/docs/settings.txt 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/docs/settings.txt 2021-12-20 20:35:50.000000000
+0100
@@ -9,9 +9,13 @@
Default: ``False``
-If this is set to ``True``, then ajax requests will not be recorded. To
-determine if a request was ajax, we use ``HttpRequest.is_ajax()``, see
-Django documentation for more information.
+If this is set to ``True``, then AJAX requests will not be recorded. To
+determine if a request was AJAX, we check that:
+
+- ``X-Requested-With`` header is set to ``XMLHttpRequest`` or
+- ``HX-Request`` header is set to ``true`` (`htmx requests`_)
+
+.. _htmx requests: https://htmx.org/
``REQUEST_IGNORE_IP``
=====================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/__init__.py
new/django-request-1.6.0/request/__init__.py
--- old/django-request-1.5.6/request/__init__.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/__init__.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,10 +1,8 @@
-__version__ = '1.5.6'
-__copyright__ = 'Copyright (c) 2009-2020, Kyle Fuller, Mariusz Felisiak'
-__licence__ = 'BSD'
+__version__ = '1.6.0'
+__copyright__ = 'Copyright (c) 2009-2021, Kyle Fuller, Mariusz Felisiak'
__author__ = [
'Kyle Fuller <[email protected]>',
'Jannis Leidel (jezdez)',
'krisje8 <[email protected]>',
'Mariusz Felisiak <[email protected]>',
]
-__URL__ = 'https://django-request.readthedocs.io/en/latest/'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/admin.py
new/django-request-1.6.0/request/admin.py
--- old/django-request-1.5.6/request/admin.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/request/admin.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,12 +1,11 @@
-# -*- coding: utf-8 -*-
import json
from datetime import date, timedelta
from functools import update_wrapper
-from django.conf.urls import url
from django.contrib import admin
from django.http import HttpResponse
from django.shortcuts import render
+from django.urls import path
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
@@ -32,7 +31,7 @@
readonly_fields = ('time',)
def get_queryset(self, request):
- return super(RequestAdmin,
self).get_queryset(request).select_related('user')
+ return super().get_queryset(request).select_related('user')
def request_from(self, obj):
if obj.user_id:
@@ -58,9 +57,9 @@
info = (self.model._meta.app_label, self.model._meta.model_name)
return [
- url(r'^overview/$', wrap(self.overview),
name='{0}_{1}_overview'.format(*info)),
- url(r'^overview/traffic/$', wrap(self.traffic),
name='{0}_{1}_traffic'.format(*info)),
- ] + super(RequestAdmin, self).get_urls()
+ path('overview/', wrap(self.overview),
name='{0}_{1}_overview'.format(*info)),
+ path('overview/traffic/', wrap(self.traffic),
name='{0}_{1}_traffic'.format(*info)),
+ ] + super().get_urls()
def overview(self, request):
qs = Request.objects.this_month()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/apps.py
new/django-request-1.6.0/request/apps.py
--- old/django-request-1.5.6/request/apps.py 1970-01-01 01:00:00.000000000
+0100
+++ new/django-request-1.6.0/request/apps.py 2021-12-20 20:35:50.000000000
+0100
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class RequestAdminConfig(AppConfig):
+ default_auto_field = 'django.db.models.AutoField'
+ name = 'request'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/management/commands/purgerequests.py
new/django-request-1.6.0/request/management/commands/purgerequests.py
--- old/django-request-1.5.6/request/management/commands/purgerequests.py
2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/management/commands/purgerequests.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from datetime import timedelta
from dateutil.relativedelta import relativedelta
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/managers.py
new/django-request-1.6.0/request/managers.py
--- old/django-request-1.5.6/request/managers.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/managers.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import datetime
import time
@@ -104,7 +103,7 @@
def __getattr__(self, attr, *args, **kwargs):
if attr in QUERYSET_PROXY_METHODS:
return getattr(self.get_queryset(), attr, None)
- super(RequestManager, self).__getattr__(*args, **kwargs)
+ super().__getattr__(*args, **kwargs)
def get_queryset(self):
return RequestQuerySet(self.model)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/middleware.py
new/django-request-1.6.0/request/middleware.py
--- old/django-request-1.5.6/request/middleware.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/middleware.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+from django.core.exceptions import ValidationError
from django.utils.deprecation import MiddlewareMixin
from . import settings
@@ -34,6 +34,11 @@
return response
r = Request()
- r.from_http_request(request, response)
-
+ try:
+ r.from_http_request(request, response, commit=False)
+ r.full_clean()
+ except ValidationError:
+ pass
+ else:
+ r.save()
return response
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/migrations/0001_initial.py
new/django-request-1.6.0/request/migrations/0001_initial.py
--- old/django-request-1.5.6/request/migrations/0001_initial.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/migrations/0001_initial.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
from django.conf import settings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/migrations/0002_alter_request_ip.py
new/django-request-1.6.0/request/migrations/0002_alter_request_ip.py
--- old/django-request-1.5.6/request/migrations/0002_alter_request_ip.py
2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/migrations/0002_alter_request_ip.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/migrations/0003_auto_20160331_1430.py
new/django-request-1.6.0/request/migrations/0003_auto_20160331_1430.py
--- old/django-request-1.5.6/request/migrations/0003_auto_20160331_1430.py
2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/migrations/0003_auto_20160331_1430.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/migrations/0004_alter_time_timezone_default.py
new/django-request-1.6.0/request/migrations/0004_alter_time_timezone_default.py
---
old/django-request-1.5.6/request/migrations/0004_alter_time_timezone_default.py
2020-08-08 17:34:24.000000000 +0200
+++
new/django-request-1.6.0/request/migrations/0004_alter_time_timezone_default.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
import django.utils.timezone
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/migrations/0005_alter_request_user.py
new/django-request-1.6.0/request/migrations/0005_alter_request_user.py
--- old/django-request-1.5.6/request/migrations/0005_alter_request_user.py
2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/migrations/0005_alter_request_user.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.conf import settings
from django.db import migrations, models
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/migrations/0006_alter_request_method_default.py
new/django-request-1.6.0/request/migrations/0006_alter_request_method_default.py
---
old/django-request-1.5.6/request/migrations/0006_alter_request_method_default.py
2020-08-08 17:34:24.000000000 +0200
+++
new/django-request-1.6.0/request/migrations/0006_alter_request_method_default.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/models.py
new/django-request-1.6.0/request/models.py
--- old/django-request-1.5.6/request/models.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/request/models.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from socket import gethostbyaddr
from django.conf import settings
@@ -6,7 +5,6 @@
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
-from six import python_2_unicode_compatible
from . import settings as request_settings
from .managers import RequestManager
@@ -15,7 +13,6 @@
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
-@python_2_unicode_compatible
class Request(models.Model):
# Response information.
response = models.SmallIntegerField(_('response'),
choices=HTTP_STATUS_CODES, default=200)
@@ -29,7 +26,7 @@
is_ajax = models.BooleanField(
_('is ajax'),
default=False,
- help_text=_('Wheather this request was used via javascript.'),
+ help_text=_('Whether this request was used via JavaScript.'),
)
# User information.
@@ -117,4 +114,4 @@
if not request_settings.LOG_USER:
self.user = None
- super(Request, self).save(*args, **kwargs)
+ super().save(*args, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/plugins.py
new/django-request-1.6.0/request/plugins.py
--- old/django-request-1.5.6/request/plugins.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/request/plugins.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from django.db.models import Count
from django.template.loader import render_to_string
@@ -33,7 +32,7 @@
return [(k, v) for v, k in items]
-class Plugins(object):
+class Plugins:
def load(self):
from importlib import import_module
@@ -72,7 +71,7 @@
plugins = Plugins()
-class Plugin(object):
+class Plugin:
def __init__(self):
self.module_name = self.__class__.__name__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/router.py
new/django-request-1.6.0/request/router.py
--- old/django-request-1.5.6/request/router.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/request/router.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,12 +1,9 @@
-# -*- coding: utf-8 -*-
import re
-from six import string_types
-
-class RegexPattern(object):
+class RegexPattern:
def __init__(self, regex, name=''):
- self.regex = re.compile(regex, re.UNICODE)
+ self.regex = re.compile(regex)
self.name = name
def resolve(self, string):
@@ -15,13 +12,13 @@
return self.name, match.groupdict()
-class Patterns(object):
+class Patterns:
def __init__(self, unknown, *args):
self.patterns = ()
self.unknown = unknown
for pattern in args:
- if isinstance(pattern, string_types):
+ if isinstance(pattern, str):
self.patterns += (RegexPattern(pattern),)
else:
self.patterns += (RegexPattern(*pattern),)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/templatetags/request_admin.py
new/django-request-1.6.0/request/templatetags/request_admin.py
--- old/django-request-1.5.6/request/templatetags/request_admin.py
2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/templatetags/request_admin.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,6 +1,6 @@
-# -*- coding: utf-8 -*-
+from urllib.parse import quote
+
from django import template
-from django.utils.http import quote
register = template.Library()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-request-1.5.6/request/templatetags/request_tag.py
new/django-request-1.6.0/request/templatetags/request_tag.py
--- old/django-request-1.5.6/request/templatetags/request_tag.py
2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/request/templatetags/request_tag.py
2021-12-20 20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from django import template
from ..models import Request
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/traffic.py
new/django-request-1.6.0/request/traffic.py
--- old/django-request-1.5.6/request/traffic.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/request/traffic.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from time import mktime
from django.core.exceptions import ImproperlyConfigured
@@ -11,7 +10,7 @@
from .utils import get_verbose_name
-class Modules(object):
+class Modules:
'''
Set of :class:`.Module`.
'''
@@ -76,7 +75,7 @@
modules = Modules()
-class Module(object):
+class Module:
'''
Base module class.
'''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/request/utils.py
new/django-request-1.6.0/request/utils.py
--- old/django-request-1.5.6/request/utils.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/request/utils.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import re
from django.conf import settings
@@ -159,7 +158,10 @@
def request_is_ajax(request):
- return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
+ return (
+ request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest' or
+ request.META.get('HTTP_HX_REQUEST') == 'true' # htmx
+ )
def handle_naive_datetime(value):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/setup.cfg
new/django-request-1.6.0/setup.cfg
--- old/django-request-1.5.6/setup.cfg 2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/setup.cfg 2021-12-20 20:35:50.000000000 +0100
@@ -1,7 +1,7 @@
[metadata]
name = django-request
-version = attr: request.__version__
-url = attr: request.__URL__
+version = 1.6.0
+url = https://django-request.readthedocs.io/en/latest/
download_url = https://pypi.org/project/django-request/
author = Kyle Fuller
author_email = [email protected]
@@ -9,34 +9,31 @@
maintainer_email = [email protected]
description = file: docs/description.txt
long_description = file: docs/long_description.txt
-license = attr: request.__licence__
+long_description_content_type = text/x-rst
+license = BSD
+license_files = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
- Framework :: Django :: 1.11
- Framework :: Django :: 2.0
- Framework :: Django :: 2.1
Framework :: Django :: 2.2
- Framework :: Django :: 3.0
- Framework :: Django :: 3.1
+ Framework :: Django :: 3.2
+ Framework :: Django :: 4.0
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
- Programming Language :: Python :: 2
- Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
- Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
+ Programming Language :: Python :: 3.9
+ Programming Language :: Python :: 3.10
[options]
install_requires =
- Django>=1.11
+ Django>=2.2
python-dateutil
- six
packages =
request
request.migrations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_admin.py
new/django-request-1.6.0/tests/test_admin.py
--- old/django-request-1.5.6/tests/test_admin.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_admin.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,22 +1,15 @@
-# -*- coding: utf-8 -*-
import json
-import django
from django.contrib.admin import site
from django.contrib.auth import get_user_model
from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
+from django.urls import reverse
from django.utils.translation import _trans
from request.admin import RequestAdmin
from request.models import Request
-try:
- from django.urls import reverse
-except ImportError:
- # to keep backward (Django < 1.10) compatibility
- from django.core.urlresolvers import reverse
-
class LookupAllowedTest(TestCase):
def test_lookup_allowed(self):
@@ -63,10 +56,7 @@
@override_settings(USE_I18N=False)
def test_traffic_without_i18n(self):
- if django.VERSION >= (2, 0):
- del _trans.gettext
- else:
- del _trans.ugettext
+ del _trans.gettext
request = self.factory.get('/foo')
self.admin.traffic(request)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_command.py
new/django-request-1.6.0/tests/test_command.py
--- old/django-request-1.5.6/tests/test_command.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_command.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,11 +1,10 @@
-# -*- coding: utf-8 -*-
from datetime import timedelta
+from io import StringIO
import mock
from django.core.management.base import CommandError
from django.test import TestCase
from django.utils.timezone import now
-from six import StringIO
from request.management.commands.purgerequests import DURATION_OPTIONS
from request.management.commands.purgerequests import Command as PurgeRequest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_managers.py
new/django-request-1.6.0/tests/test_managers.py
--- old/django-request-1.5.6/tests/test_managers.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_managers.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from datetime import date, timedelta
from django.contrib.auth import get_user_model
@@ -104,29 +103,29 @@
def test_month_is_december(self):
# setUp
- december_date = date(2015, 12, 1)
- self.request.time = december_date
+ december_time = now().replace(month=12)
+ self.request.time = december_time
self.request.save()
# Test
- qs = Request.objects.all().month(date=december_date)
+ qs = Request.objects.all().month(date=december_time.date())
self.assertEqual(1, qs.count())
def test_month_is_not_december(self):
# setUp
- november_date = date(2015, 11, 1)
- self.request.time = november_date
+ november_time = now().replace(month=11)
+ self.request.time = november_time
self.request.save()
# Test
- qs = Request.objects.all().month(date=november_date)
+ qs = Request.objects.all().month(date=november_time.date())
self.assertEqual(1, qs.count())
def test_week(self):
# setUp
- january_date = date(2015, 1, 6)
- self.request.time = january_date
+ january_time = now().replace(month=1, day=6)
+ self.request.time = january_time
self.request.save()
# Test
- qs = Request.objects.all().week(year='2015', week='1')
+ qs = Request.objects.all().week(year=str(january_time.year), week='1')
self.assertEqual(qs.count(), 1)
def test_week_invalid_year_or_week(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_middlewares.py
new/django-request-1.6.0/tests/test_middlewares.py
--- old/django-request-1.5.6/tests/test_middlewares.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_middlewares.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import mock
from django.contrib.auth import get_user_model
from django.http import HttpResponse, HttpResponseServerError
@@ -91,6 +90,16 @@
self.middleware(request)
self.assertEqual(1, Request.objects.count())
+ @mock.patch('request.middleware.settings.IGNORE_AJAX', True)
+ def test_dont_record_htmx(self):
+ request = self.factory.get('/foo')
+ # Non-htmx
+ self.middleware(request)
+ # htmx
+ request.META['HTTP_HX_REQUEST'] = 'true'
+ self.middleware(request)
+ self.assertEqual(Request.objects.count(), 1)
+
@mock.patch('request.middleware.settings.IGNORE_AJAX',
False)
def test_record_ajax(self):
@@ -102,6 +111,16 @@
self.middleware(request)
self.assertEqual(2, Request.objects.count())
+ @mock.patch('request.middleware.settings.IGNORE_AJAX', False)
+ def test_record_htmx(self):
+ request = self.factory.get('/foo')
+ # Non-htmx
+ self.middleware(request)
+ # htmx
+ request.META['HTTP_HX_REQUEST'] = 'true'
+ self.middleware(request)
+ self.assertEqual(Request.objects.count(), 2)
+
@mock.patch('request.middleware.settings.IGNORE_IP',
('1.2.3.4',))
def test_dont_record_ignored_ips(self):
@@ -114,6 +133,12 @@
self.middleware(request)
self.assertEqual(1, Request.objects.count())
+ def test_invalid_addr(self):
+ request = self.factory.get('/foo')
+ request.META['REMOTE_ADDR'] = 'invalid-addr'
+ self.middleware(request)
+ self.assertEqual(Request.objects.count(), 0)
+
@mock.patch('request.middleware.settings.IGNORE_USER_AGENTS',
(r'^.*Foo.*$',))
def test_dont_record_ignored_user_agents(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_models.py
new/django-request-1.6.0/tests/test_models.py
--- old/django-request-1.5.6/tests/test_models.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_models.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import socket
from datetime import datetime
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_plugins.py
new/django-request-1.6.0/tests/test_plugins.py
--- old/django-request-1.5.6/tests/test_plugins.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_plugins.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import mock
from django.core import exceptions
from django.test import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_router.py
new/django-request-1.6.0/tests/test_router.py
--- old/django-request-1.5.6/tests/test_router.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_router.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from django.test import TestCase
from request import router
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_settings.py
new/django-request-1.6.0/tests/test_settings.py
--- old/django-request-1.5.6/tests/test_settings.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_settings.py 2021-12-20
20:35:50.000000000 +0100
@@ -52,3 +52,5 @@
},
},
]
+
+USE_TZ = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_templatestags.py
new/django-request-1.6.0/tests/test_templatestags.py
--- old/django-request-1.5.6/tests/test_templatestags.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_templatestags.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from django import template
from django.test import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_traffic.py
new/django-request-1.6.0/tests/test_traffic.py
--- old/django-request-1.5.6/tests/test_traffic.py 2020-08-08
17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tests/test_traffic.py 2021-12-20
20:35:50.000000000 +0100
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import mock
from django.core import exceptions
from django.test import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tests/test_urls.py
new/django-request-1.6.0/tests/test_urls.py
--- old/django-request-1.5.6/tests/test_urls.py 2020-08-08 17:34:24.000000000
+0200
+++ new/django-request-1.6.0/tests/test_urls.py 2021-12-20 20:35:50.000000000
+0100
@@ -1,7 +1,6 @@
-# -*- coding: utf-8 -*-
-from django.conf.urls import url
from django.contrib import admin
+from django.urls import path
urlpatterns = [
- url(r'^admin/', admin.site.urls),
+ path('admin/', admin.site.urls),
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-request-1.5.6/tox.ini
new/django-request-1.6.0/tox.ini
--- old/django-request-1.5.6/tox.ini 2020-08-08 17:34:24.000000000 +0200
+++ new/django-request-1.6.0/tox.ini 2021-12-20 20:35:50.000000000 +0100
@@ -1,38 +1,34 @@
[tox]
envlist =
- {py27,py34,py36,py37}-django111-test
- {py34,py36,py37}-django20-test
- {py36,py37}-django{21,22,30,31,master}-test
- py38-django{22,30,31,master}-test
+ {py36,py37,py38,py39}-django{22}-test
+ {py36,py37,py38,py39,py310}-django{32}-test
+ {py38,py39,py310}-django{main,40}-test
isort
flake
[testenv]
basepython =
- py27: python2.7
- py34: python3.4
py36: python3.6
py37: python3.7
py38: python3.8
+ py39: python3.9
+ py310: python3.10
commands =
test: coverage run ./runtests.py
deps =
coverage
mock==2.0.0
- django111: Django>=1.11,<2.0
- django20: Django>=2.0,<2.1
- django21: Django>=2.1,<2.2
django22: Django>=2.2,<3.0
- django30: Django>=3.0,<3.1
- django31: Django>=3.1,<3.2
- djangomaster: https://github.com/django/django/archive/master.tar.gz
+ django32: Django>=3.2,<4.0
+ django40: Django>=4.0,<4.1
+ djangomain: https://github.com/django/django/archive/main.tar.gz
[testenv:isort]
-basepython = python3.8
+basepython = python3.10
deps = isort >= 5.1.0
commands = isort --check-only --diff request tests setup.py runtests.py
[testenv:flake]
-basepython = python3.8
+basepython = python3.10
deps = flake8
commands = flake8
++++++ set-timezone-for-day-tests.patch ++++++
Index: django-request-1.6.0/tests/test_managers.py
===================================================================
--- django-request-1.6.0.orig/tests/test_managers.py
+++ django-request-1.6.0/tests/test_managers.py
@@ -134,12 +134,14 @@ class RequestQuerySetTest(TestCase):
qs = Request.objects.all().week(year='foo', week='1')
self.assertIsNone(qs)
+ @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
def test_day(self):
qs = Request.objects.all().day(date=now())
self.assertEqual(1, qs.count())
qs = Request.objects.all().day(date=now() - timedelta(days=3))
self.assertEqual(0, qs.count())
+ @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
def test_day_without_date(self):
qs = Request.objects.all().day(
year=str(now().year),