File python-django-waliki-django30-compat.patch of Package python-django-waliki
From 533c507b88754eb0d82957d968a247cd1d9c2bf9 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Sun, 19 Apr 2020 01:54:34 +0100
Subject: [PATCH] Compatibility fixes for Django 3.0.
The django.utils.six package was removed, using six instead.
The python_2_unicode_compatible() function was removed from
django.utils.encoding package, using six.python_2_unicode_compatible instead.
The available_attrs() function was removed from django.utils.decorators
package, using function returning functools.WRAPPER_ASSIGNMENTS instead.
The staticfiles templatetag was removed, using static templatetag instead.
This breaks compatibility with Django versions older than 1.4.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
waliki/acl.py | 12 +++++++++---
waliki/attachments/models.py | 4 ++--
waliki/attachments/templates/waliki/attachments.html | 4 ++--
waliki/attachments/views.py | 2 +-
waliki/git/models.py | 2 +-
waliki/git/views.py | 2 +-
waliki/models.py | 2 +-
waliki/templates/base.html | 2 +-
waliki/utils.py | 2 +-
.../waliki_project/templates/site_base.html | 4 ++--
10 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/waliki/acl.py b/waliki/acl.py
index 2f67175..716568a 100644
--- a/waliki/acl.py
+++ b/waliki/acl.py
@@ -1,12 +1,18 @@
from functools import wraps
from collections import Iterable
+from django import VERSION
from django.conf import settings
from django.shortcuts import render
from django.core.exceptions import PermissionDenied
-from django.utils.decorators import available_attrs
+if VERSION[0] >= 3:
+ from functools import WRAPPER_ASSIGNMENTS
+ def available_attrs(fn):
+ return WRAPPER_ASSIGNMENTS
+else:
+ from django.utils.decorators import available_attrs
from django.utils.encoding import force_str
-from django.utils.six.moves.urllib.parse import urlparse
-from django.utils.six import string_types
+from six.moves.urllib.parse import urlparse
+from six import string_types
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.shortcuts import resolve_url
from waliki.utils import is_authenticated
diff --git a/waliki/attachments/models.py b/waliki/attachments/models.py
index 52ebfec..adf5bef 100644
--- a/waliki/attachments/models.py
+++ b/waliki/attachments/models.py
@@ -5,8 +5,8 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import pre_delete
from django.dispatch.dispatcher import receiver
-from django.utils.encoding import python_2_unicode_compatible
-from django.utils.six import text_type
+from six import python_2_unicode_compatible
+from six import text_type
if VERSION[:2] >= (1, 10):
from django.urls import reverse
else:
diff --git a/waliki/attachments/templates/waliki/attachments.html b/waliki/attachments/templates/waliki/attachments.html
index df9ea4e..d8f8818 100644
--- a/waliki/attachments/templates/waliki/attachments.html
+++ b/waliki/attachments/templates/waliki/attachments.html
@@ -1,4 +1,4 @@
-{% load staticfiles %}
+{% load static %}
{% load i18n %}
{% load waliki_tags %}
@@ -236,4 +236,4 @@ that reload the same view but in a popup window. The popup show the same view, b
});
});
-</script>
\ No newline at end of file
+</script>
diff --git a/waliki/attachments/views.py b/waliki/attachments/views.py
index 96f498c..78e35ed 100644
--- a/waliki/attachments/views.py
+++ b/waliki/attachments/views.py
@@ -3,7 +3,7 @@ import json
import imghdr
from django.shortcuts import render, get_object_or_404
from django.contrib import messages
-from django.utils.six import text_type
+from six import text_type
from django.http import HttpResponse
from sendfile import sendfile
from waliki.models import Page
diff --git a/waliki/git/models.py b/waliki/git/models.py
index 5161de8..6410249 100644
--- a/waliki/git/models.py
+++ b/waliki/git/models.py
@@ -4,7 +4,7 @@ import re
from django.contrib.auth import get_user_model
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
-from django.utils import six
+import six
_
from sh import git, ErrorReturnCode, Command
from collections import namedtuple
diff --git a/waliki/git/views.py b/waliki/git/views.py
index e1237a6..b68ee7d 100644
--- a/waliki/git/views.py
+++ b/waliki/git/views.py
@@ -14,7 +14,7 @@ if VERSION[:2] >= (1, 10):
else:
from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.encoding import smart_text
-from django.utils.six import StringIO, text_type
+from six import StringIO, text_type
from django.views.decorators.csrf import csrf_exempt
from waliki.models import Page
from waliki.forms import PageForm
diff --git a/waliki/models.py b/waliki/models.py
index 3bade31..1a6ad8d 100644
--- a/waliki/models.py
+++ b/waliki/models.py
@@ -13,7 +13,7 @@ if VERSION[:2] >= (1, 10):
else:
from django.core.urlresolvers import reverse
from django.dispatch import receiver
-from django.utils.six import string_types
+from six import string_types
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Permission, Group, AnonymousUser
from django.contrib.auth import get_user_model
diff --git a/waliki/templates/base.html b/waliki/templates/base.html
index 980c0b0..89bce35 100644
--- a/waliki/templates/base.html
+++ b/waliki/templates/base.html
@@ -1,4 +1,4 @@
-{% load staticfiles %}
+{% load static %}
{% load waliki_tags %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
diff --git a/waliki/utils.py b/waliki/utils.py
index 27dadc3..c259c2a 100644
--- a/waliki/utils.py
+++ b/waliki/utils.py
@@ -8,7 +8,7 @@ if VERSION[:2] >= (1, 10):
from django.urls import reverse
else:
from django.core.urlresolvers import reverse
-from django.utils.six import PY2
+from six import PY2
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
diff --git a/waliki_project/waliki_project/templates/site_base.html b/waliki_project/waliki_project/templates/site_base.html
index ba29d6d..6b87dc8 100644
--- a/waliki_project/waliki_project/templates/site_base.html
+++ b/waliki_project/waliki_project/templates/site_base.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load staticfiles %}
+{% load static %}
{% load waliki_tags %}
{% load i18n %}
{% load account %}
@@ -46,4 +46,4 @@
</div>
</div>
</div>
- {% endblock %}
\ No newline at end of file
+ {% endblock %}
--
2.33.1