~netlandish/django-wiki

5df639b43d52d232a2a90da99e4fc77ff2757c90 — Raffaele Salmaso 6 years ago 459307c
Removed six usage.
M src/wiki/core/plugins/registry.py => src/wiki/core/plugins/registry.py +1 -3
@@ 1,7 1,5 @@
from importlib import import_module

from django.utils.six import string_types

_cache = {}
_settings_forms = []
_markdown_extensions = []


@@ 23,7 21,7 @@ def register(PluginClass):

    settings_form = getattr(PluginClass, 'settings_form', None)
    if settings_form:
        if isinstance(settings_form, string_types):
        if isinstance(settings_form, str):
            klassname = settings_form.split(".")[-1]
            modulename = ".".join(settings_form.split(".")[:-1])
            form_module = import_module(modulename)

M src/wiki/models/__init__.py => src/wiki/models/__init__.py +2 -3
@@ 1,7 1,6 @@
from django.apps import apps
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.six import string_types, text_type

# TODO: Don't use wildcards
from .article import *  # noqa


@@ 76,7 75,7 @@ def reverse(*args, **kwargs):
    return the result of calling reverse._transform_url(reversed_url)
    for every url in the wiki namespace.
    """
    if isinstance(args[0], string_types) and args[0].startswith('wiki:'):
    if isinstance(args[0], str) and args[0].startswith('wiki:'):
        url_kwargs = kwargs.get('kwargs', {})
        path = url_kwargs.get('path', False)
        # If a path is supplied then discard the article_id


@@ 95,7 94,7 @@ def reverse(*args, **kwargs):


# Now we redefine reverse method
reverse_lazy = lazy(reverse, text_type)
reverse_lazy = lazy(reverse, str)
urlresolvers.reverse = reverse
urlresolvers.reverse_lazy = reverse_lazy


M src/wiki/plugins/macros/mdx/macro.py => src/wiki/plugins/macros/mdx/macro.py +1 -2
@@ 3,7 3,6 @@ import re
import markdown
from django.template.loader import render_to_string
from django.utils.translation import gettext as _
from django.utils.six import string_types
from wiki.plugins.macros import settings

# See:


@@ 51,7 50,7 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor):
                            value = kwarg.group('value')
                            if value is None:
                                value = True
                            if isinstance(value, string_types):
                            if isinstance(value, str):
                                # If value is enclosed with ': Remove and
                                # remove escape sequences
                                if value.startswith("'") and len(value) > 2:

M tests/core/test_template_tags.py => tests/core/test_template_tags.py +3 -4
@@ 4,7 4,6 @@ Almost all test cases covers both tag calling and template using.
from django.conf import settings as django_settings
from django.contrib.contenttypes.models import ContentType
from django.http import HttpRequest
from django.utils.six import assertCountEqual

from wiki.conf import settings
from wiki.forms import CreateRootForm


@@ 168,7 167,7 @@ class WikiRenderTest(TemplateTestCase):

        output = wiki_render({}, article)

        assertCountEqual(self, self.keys, output)
        self.assertCountEqual(self.keys, output)

        self.assertEqual(output['article'], article)
        self.assertIsNone(output['content'])


@@ 207,7 206,7 @@ class WikiRenderTest(TemplateTestCase):
        registry._cache = {'spam': 'eggs'}

        output = wiki_render({}, article, preview_content=content)
        assertCountEqual(self, self.keys, output)
        self.assertCountEqual(self.keys, output)
        self.assertEqual(output['article'], article)
        self.assertMultiLineEqual(output['content'], expected_markdown)
        self.assertIs(output['preview'], True)


@@ 236,7 235,7 @@ class WikiRenderTest(TemplateTestCase):

        output = wiki_render({}, article, preview_content=content)

        assertCountEqual(self, self.keys, output)
        self.assertCountEqual(self.keys, output)

        self.assertEqual(output['article'], article)