M src/wiki/compat.py => src/wiki/compat.py +21 -0
@@ 1,3 1,7 @@
+"""Abstraction layer to deal with Django related changes in order to keep
+compatibility with several Django versions simultaneously."""
+
+
try:
from django.urls import include, re_path as url
except ImportError:
@@ 5,5 9,22 @@ except ImportError:
__all__ = [
+ 'BuildAttrsCompat',
'include', 'url'
]
+
+
+# Django 1.11 Widget.build_attrs has a different signature, designed for the new
+# template based rendering. The previous version was more useful for our needs,
+# so we restore that version.
+# When support for Django < 1.11 is dropped, we should look at using the
+# new template based rendering, at which point this probably won't be needed at all.
+class BuildAttrsCompat:
+ def build_attrs_compat(self, extra_attrs=None, **kwargs):
+ "Helper function for building an attribute dictionary."
+ attrs = self.attrs.copy()
+ if extra_attrs is not None:
+ attrs.update(extra_attrs)
+ if kwargs is not None:
+ attrs.update(kwargs)
+ return attrs
D src/wiki/core/compat.py => src/wiki/core/compat.py +0 -18
@@ 1,18 0,0 @@
-"""Abstraction layer to deal with Django related changes in order to keep
-compatibility with several Django versions simultaneously."""
-
-
-# Django 1.11 Widget.build_attrs has a different signature, designed for the new
-# template based rendering. The previous version was more useful for our needs,
-# so we restore that version.
-# When support for Django < 1.11 is dropped, we should look at using the
-# new template based rendering, at which point this probably won't be needed at all.
-class BuildAttrsCompat:
- def build_attrs_compat(self, extra_attrs=None, **kwargs):
- "Helper function for building an attribute dictionary."
- attrs = self.attrs.copy()
- if extra_attrs is not None:
- attrs.update(extra_attrs)
- if kwargs is not None:
- attrs.update(kwargs)
- return attrs
M src/wiki/editors/markitup.py => src/wiki/editors/markitup.py +1 -1
@@ 4,7 4,7 @@ from django.utils.encoding import force_text
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
-from wiki.core.compat import BuildAttrsCompat
+from wiki.compat import BuildAttrsCompat
from wiki.editors.base import BaseEditor
M src/wiki/forms.py => src/wiki/forms.py +1 -1
@@ 23,8 23,8 @@ from django.utils.translation import gettext_lazy as _
from wiki import models
from wiki.conf import settings
+from wiki.compat import BuildAttrsCompat
from wiki.core import permissions
-from wiki.core.compat import BuildAttrsCompat
from wiki.core.diff import simple_merge
from wiki.core.plugins.base import PluginSettingsFormMixin
from wiki.editors import getEditor