Skip to content

Commit

Permalink
[deps] Maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Nov 29, 2024
1 parent d4e933c commit d41fcba
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 92 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
build:
name: Python==${{ matrix.python-version }} | ${{ matrix.django-version }}
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

services:
redis:
Expand All @@ -25,11 +25,11 @@ jobs:
fail-fast: false
matrix:
python-version:
- 3.8
- 3.9
- "3.9"
- "3.10"
django-version:
- django~=3.2.0
- django~=4.0.0
- django~=4.2.0

steps:
- uses: actions/checkout@v2
Expand All @@ -53,8 +53,8 @@ jobs:
run: |
pip install -U pip wheel setuptools
pip install -U -e .
pip install -U ${{ matrix.django-version }}
pip install -U -r requirements-test.txt
pip install -U ${{ matrix.django-version }}
- name: QA checks
run: ./run-qa-checks
Expand Down
36 changes: 23 additions & 13 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,57 @@ Version 0.4.1 [2018-02-19]
Version 0.4.0 [2017-05-24]
--------------------------

- `8078e07 <https://github.com/openwisp/django-owm-legacy/commit/8078e07>`_:
- `8078e07
<https://github.com/openwisp/django-owm-legacy/commit/8078e07>`_:
Upgraded to **django-netjsonconfig 0.6.0**

Version 0.3.1 [2017-03-08]
--------------------------

- `fb595bd <https://github.com/openwisp/django-owm-legacy/commit/fb595bd>`_:
- `fb595bd
<https://github.com/openwisp/django-owm-legacy/commit/fb595bd>`_:
[views] Added support for openwisp-controller

Version 0.3.0 [2017-01-18]
--------------------------

- `2db46c8 <https://github.com/openwisp/django-owm-legacy/commit/2db46c8>`_:
- `2db46c8
<https://github.com/openwisp/django-owm-legacy/commit/2db46c8>`_:
[requirements] set minimum `django-netjsonconfig
<https://github.com/openwisp/django-netjsonconfig>`_ version to 0.5.0
- `f388d9c <https://github.com/openwisp/django-owm-legacy/commit/f388d9c>`_:
- `f388d9c
<https://github.com/openwisp/django-owm-legacy/commit/f388d9c>`_:
[views] use ``mac_address`` field instead of ``key``
- `5a8b793 <https://github.com/openwisp/django-owm-legacy/commit/5a8b793>`_:
- `5a8b793
<https://github.com/openwisp/django-owm-legacy/commit/5a8b793>`_:
[views] added compatibility with ``openwisp2.config``

Version 0.2.3 [2016-02-29]
--------------------------

- `b162867 <https://github.com/openwisp/django-owm-legacy/commit/b162867>`_:
log denied requests with warning level
- `b162867
<https://github.com/openwisp/django-owm-legacy/commit/b162867>`_: log
denied requests with warning level

Version 0.2.2 [2016-02-12]
--------------------------

- `f66bec1 <https://github.com/openwisp/django-owm-legacy/commit/f66bec1>`_:
update ``last_ip`` on checksum if necessary
- `4ae482e <https://github.com/openwisp/django-owm-legacy/commit/4ae482e>`_:
- `f66bec1
<https://github.com/openwisp/django-owm-legacy/commit/f66bec1>`_: update
``last_ip`` on checksum if necessary
- `4ae482e
<https://github.com/openwisp/django-owm-legacy/commit/4ae482e>`_:
updated minimum ``django-netjsonconfig`` version to 0.2.3

Version 0.2.1 [2016-01-28]
--------------------------

- `ebf950a <https://github.com/openwisp/django-owm-legacy/commit/ebf950a>`_:
- `ebf950a
<https://github.com/openwisp/django-owm-legacy/commit/ebf950a>`_:
updated requirements.txt
- `61e6ddd <https://github.com/openwisp/django-owm-legacy/commit/61e6ddd>`_:
fill last_ip and status fields when config is downloaded
- `61e6ddd
<https://github.com/openwisp/django-owm-legacy/commit/61e6ddd>`_: fill
last_ip and status fields when config is downloaded

Version 0.2 [2016-01-14]
------------------------
Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Contributing
============

Thanks for your interest! We love contributions, so please feel free to fix bugs, improve things, provide documentation.
Just `follow the guidelines <https://github.com/openwisp/django-owm-legacy#contributing>`_ and submit a PR.
Thanks for your interest! We love contributions, so please feel free to
fix bugs, improve things, provide documentation. Just `follow the
guidelines <https://github.com/openwisp/django-owm-legacy#contributing>`_
and submit a PR.
103 changes: 53 additions & 50 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ django-owm-legacy
=================

.. image:: https://github.com/openwisp/django-owm-legacy/workflows/Django%20OWM%20Legacy%20CI%20Build/badge.svg?branch=master
:target: https://github.com/openwisp/django-owm-legacy/actions?query=workflow%3A"Django%20OWM%20Legacy%20CI%20Build"
:alt: CI build status
:target: https://github.com/openwisp/django-owm-legacy/actions?query=workflow%3A"Django%20OWM%20Legacy%20CI%20Build"
:alt: CI build status

.. image:: https://coveralls.io/repos/openwisp/django-owm-legacy/badge.svg
:target: https://coveralls.io/r/openwisp/django-owm-legacy
:alt: Test Coverage
:target: https://coveralls.io/r/openwisp/django-owm-legacy
:alt: Test Coverage

.. image:: https://img.shields.io/librariesio/release/github/openwisp/django-owm-legacy
:target: https://libraries.io/github/openwisp/django-owm-legacy#repository_dependencies
:alt: Dependency monitoring
:target: https://libraries.io/github/openwisp/django-owm-legacy#repository_dependencies
:alt: Dependency monitoring

.. image:: https://img.shields.io/gitter/room/nwjs/nw.js.svg
:target: https://gitter.im/openwisp/general
:alt: Chat
:target: https://gitter.im/openwisp/general
:alt: Chat

.. image:: https://badge.fury.io/py/django-owm-legacy.svg
:target: http://badge.fury.io/py/django-owm-legacy
:target: http://badge.fury.io/py/django-owm-legacy

.. image:: https://pepy.tech/badge/django-owm-legacy
:target: https://pepy.tech/project/django-owm-legacy
:alt: Downloads
:target: https://pepy.tech/project/django-owm-legacy
:alt: Downloads

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://pypi.org/project/black/
:alt: code style: black
:target: https://pypi.org/project/black/
:alt: code style: black

------------
----

Legacy features of OpenWISP Manager reimplemented in django for `OpenWISP2
<https://github.com/openwisp/ansible-openwisp2>`_.
Expand Down Expand Up @@ -68,46 +68,47 @@ If you want to contribute, install your cloned fork:
Setup (integrate in an existing django project)
-----------------------------------------------

Add ``openwisp_controller`` and ``owm_legacy`` to ``INSTALLED_APPS`` as follow:
Add ``openwisp_controller`` and ``owm_legacy`` to ``INSTALLED_APPS`` as
follow:

.. code-block:: python
INSTALLED_APPS = [
# ...
'django.contrib.sites',
"django.contrib.sites",
# allauth
'allauth',
'allauth.account',
'django_extensions',
"allauth",
"allauth.account",
"django_extensions",
# openwisp2 modules
'openwisp_controller.config',
'openwisp_controller.pki',
'openwisp_controller.geo',
'openwisp_controller.connection',
'openwisp_users',
'openwisp_notifications',
'openwisp_ipam',
"openwisp_controller.config",
"openwisp_controller.pki",
"openwisp_controller.geo",
"openwisp_controller.connection",
"openwisp_users",
"openwisp_notifications",
"openwisp_ipam",
# openwisp2 admin theme
# (must be loaded here)
'openwisp_utils.admin_theme',
'django.contrib.admin',
'django.forms',
"openwisp_utils.admin_theme",
"django.contrib.admin",
"django.forms",
# other dependencies
'sortedm2m',
'reversion',
'leaflet',
'flat_json_widget',
'owm_legacy',
"sortedm2m",
"reversion",
"leaflet",
"flat_json_widget",
"owm_legacy",
# ...
]
Other settings needed in ``settings.py``:

.. code-block:: python
EXTENDED_APPS = ('django_x509', 'django_loci')
EXTENDED_APPS = ("django_x509", "django_loci")
AUTH_USER_MODEL = 'openwisp_users.User'
AUTH_USER_MODEL = "openwisp_users.User"
SITE_ID = 1
Your ``urls.py`` should look like the following:
Expand All @@ -122,9 +123,9 @@ Your ``urls.py`` should look like the following:
urlpatterns = [
path('admin/', include(admin.site.urls)),
path('', include('openwisp_controller.urls', namespace='controller')),
path('', include('owm_legacy.urls', namespace='owm_legacy')),
path("admin/", include(admin.site.urls)),
path("", include("openwisp_controller.urls", namespace="controller")),
path("", include("owm_legacy.urls", namespace="owm_legacy")),
]
urlpatterns += staticfiles_urlpatterns()
Expand Down Expand Up @@ -193,31 +194,33 @@ Settings
``OWM_LEGACY_ALLOWED_SUBNETS``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+--------------+------------------------------------------+
| **type**: | ``list`` |
+--------------+------------------------------------------+
| **default**: | ``['10.8.0.0/16', '127.0.0.1/32']`` |
+--------------+------------------------------------------+
============ ===================================
**type**: ``list``
**default**: ``['10.8.0.0/16', '127.0.0.1/32']``
============ ===================================

List of strings representing ip networks allowed to retrieve
checksums and download configuration archives.
List of strings representing ip networks allowed to retrieve checksums and
download configuration archives.

Contributing
------------

Please refer to the `OpenWISP contributing guidelines <http://openwisp.io/docs/developer/contributing.html>`_.
Please refer to the `OpenWISP contributing guidelines
<http://openwisp.io/docs/developer/contributing.html>`_.

.. _PEP8, Style Guide for Python Code: http://www.python.org/dev/peps/pep-0008/
.. _pep8, style guide for python code: http://www.python.org/dev/peps/pep-0008/

Changelog
---------

See `CHANGES <https://github.com/openwisp/django-owm-legacy/blob/master/CHANGES.rst>`_.
See `CHANGES
<https://github.com/openwisp/django-owm-legacy/blob/master/CHANGES.rst>`_.

License
-------

See `LICENSE <https://github.com/openwisp/django-owm-legacy/blob/master/LICENSE>`_.
See `LICENSE
<https://github.com/openwisp/django-owm-legacy/blob/master/LICENSE>`_.

Support
-------
Expand Down
4 changes: 1 addition & 3 deletions owm_legacy/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@


class TestOwmLegacy(CreateConfigMixin, TestOrganizationMixin, TestCase):
"""
tests for owm_legacy
"""
"""tests for owm_legacy"""

config_model = Config
device_model = Device
Expand Down
12 changes: 5 additions & 7 deletions owm_legacy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@


def ip_allowed(address_string):
"""
returns ``True`` if specified ip address is allowed
according to ``settings.OWM_LEGACY_ALLOWED_SUBNETS``
otherwise returns ``False``
"""returns ``True`` if specified ip address is allowed
according to ``settings.OWM_LEGACY_ALLOWED_SUBNETS`` otherwise returns
``False``
"""
ip_address = ipaddress.ip_address(address_string.encode().decode())
for subnet_string in ALLOWED_SUBNETS:
Expand All @@ -23,9 +23,7 @@ def ip_allowed(address_string):


def forbid_unallowed(request):
"""
raises ``PermissionDenied`` if remote address is not allowed
"""
"""raises ``PermissionDenied`` if remote address is not allowed"""
if not ip_allowed(request.META.get('REMOTE_ADDR')):
logger.warning('PermissionDenied', extra={'request': request, 'stack': True})
raise PermissionDenied
8 changes: 2 additions & 6 deletions owm_legacy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@


def get_config_md5(request, mac_address):
"""
returns md5 of configuration
"""
"""returns md5 of configuration"""
forbid_unallowed(request)
config = get_object_or_404(Config, device__mac_address__iexact=mac_address)
# in OpenWISP 1, the last_ip field and the management_ip are the same
Expand All @@ -31,9 +29,7 @@ def get_config_md5(request, mac_address):


def get_config(request, mac_address):
"""
returns configuration tar.gz
"""
"""returns configuration tar.gz"""
forbid_unallowed(request)
config = get_object_or_404(Config, device__mac_address__iexact=mac_address)
config.set_status_applied()
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
coveralls
openwisp-utils[qa]~=1.0.0
openwisp-utils[qa]>=1.0.0,<1.2.0
django-redis
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
openwisp-controller~=1.0.0
openwisp-controller>=1.0.0,<1.2.0
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@


def get_install_requires():
"""
parse requirements.txt, ignore links, exclude comments
"""
"""parse requirements.txt, ignore links, exclude comments"""
requirements = []
for line in open('requirements.txt').readlines():
# skip to next iteration if comment or empty line
Expand Down Expand Up @@ -50,7 +48,7 @@ def get_install_requires():
zip_safe=False,
install_requires=get_install_requires(),
classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable ',
'Environment :: Web Environment',
'Topic :: Internet :: WWW/HTTP',
'Intended Audience :: Developers',
Expand Down
1 change: 1 addition & 0 deletions tests/openwisp2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'allauth.account.middleware.AccountMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
Expand Down

0 comments on commit d41fcba

Please sign in to comment.