dfunckt / django-rules

Awesome Django authorization, without the database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Django 4.0

uri-rodberg opened this issue · comments

rules doesn't support Django 4.0

from django.utils.encoding import force_text

https://docs.djangoproject.com/en/4.0/releases/4.0/

django.utils.encoding.force_text() and smart_text() are removed.

https://docs.djangoproject.com/en/4.0/releases/3.0/#deprecated-features-3-0

The smart_text() and force_text() aliases (since Django 2.0) of smart_str() and force_str() are deprecated. Ignore this deprecation if your code supports Python 2 as the behavior of smart_str() and force_str() is different there.

Just replace force_text with force_str in rules/contrib/views.py.

This is fixed by #153, it would be nice to have this available in a release now that django 4.0 is released.

Also tests are failing due to:

ImportError: cannot import name 'url' from 'django.conf.urls' (/home/runner/work/django-rules/django-rules/.tox/packaging/lib/python3.10/site-packages/django/conf/urls/__init__.py)

Since url is deprecated in 4.0

v3.1.0 was just published, will soon be on PyPi too. Apologies for the delay. Thanks folks!