From f9f88c9a39e1237b5136b204d31a9c11bbb8aefa Mon Sep 17 00:00:00 2001 From: Frank Loemker Date: Mon, 29 Jan 2018 21:29:41 -0500 Subject: [PATCH] Adaption to HEAD and small style clean up's. --- docs/plugins.rst | 2 +- docs/settings.rst | 2 +- src/wiki/forms.py | 3 +-- src/wiki/plugins/editsection/__init__.py | 3 +++ src/wiki/plugins/editsection/apps.py | 10 ++++++++++ src/wiki/plugins/editsection/markdown_extensions.py | 6 +++--- src/wiki/plugins/editsection/views.py | 3 +-- tests/settings.py | 2 +- 8 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 src/wiki/plugins/editsection/apps.py diff --git a/docs/plugins.rst b/docs/plugins.rst index 7fa710cb..cb49d639 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -5,7 +5,7 @@ Add/remove the following to your ``settings.INSTALLED_APPS`` to enable/disable the core plugins: - ``'wiki.plugins.attachments.apps.AttachmentsConfig'`` -- ``'wiki.plugins.editsection.apps.AttachmentsConfig'`` +- ``'wiki.plugins.editsection.apps.EditSectionConfig'`` - ``'wiki.plugins.globalhistory.apps.GlobalHistoryConfig'`` - ``'wiki.plugins.help.apps.HelpConfig'`` - ``'wiki.plugins.images.apps.ImagesConfig'`` diff --git a/docs/settings.rst b/docs/settings.rst index 87e19acb..9a279057 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -17,7 +17,7 @@ Plugin attachments :members: Plugin editSection -------------- +------------------ .. automodule:: wiki.plugins.editsection.settings :members: diff --git a/src/wiki/forms.py b/src/wiki/forms.py index 9c0177f5..c83555d7 100644 --- a/src/wiki/forms.py +++ b/src/wiki/forms.py @@ -265,8 +265,7 @@ class EditForm(forms.Form, SpamProtectionMixin): if provided_content: self.presumed_revision = self.initial_revision.id else: - newdata['content'] = simple_merge( - content, data.get('content', "")) + newdata['content'] = simple_merge(content, data.get('content', "")) newdata['title'] = current_revision.title kwargs['data'] = newdata else: diff --git a/src/wiki/plugins/editsection/__init__.py b/src/wiki/plugins/editsection/__init__.py index e69de29b..c829665e 100644 --- a/src/wiki/plugins/editsection/__init__.py +++ b/src/wiki/plugins/editsection/__init__.py @@ -0,0 +1,3 @@ +from __future__ import unicode_literals + +default_app_config = 'wiki.plugins.editsection.apps.EditSectionConfig' diff --git a/src/wiki/plugins/editsection/apps.py b/src/wiki/plugins/editsection/apps.py new file mode 100644 index 00000000..518ec06f --- /dev/null +++ b/src/wiki/plugins/editsection/apps.py @@ -0,0 +1,10 @@ +from __future__ import unicode_literals + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class EditSectionConfig(AppConfig): + name = 'wiki.plugins.editsection' + verbose_name = _("Wiki edit section") + label = 'wiki_editsection' diff --git a/src/wiki/plugins/editsection/markdown_extensions.py b/src/wiki/plugins/editsection/markdown_extensions.py index 5f9b0422..8c5c2def 100644 --- a/src/wiki/plugins/editsection/markdown_extensions.py +++ b/src/wiki/plugins/editsection/markdown_extensions.py @@ -24,10 +24,10 @@ class EditSectionExtension(Extension): def get_header_id(header): - id = ''.join(w[0] for w in re.findall("\w+", header)) - if not len(id): + header_id = ''.join(w[0] for w in re.findall("\w+", header)) + if not len(header_id): return '_' - return id + return header_id class EditSectionProcessor(Treeprocessor): diff --git a/src/wiki/plugins/editsection/views.py b/src/wiki/plugins/editsection/views.py index e92b605f..78a6059d 100644 --- a/src/wiki/plugins/editsection/views.py +++ b/src/wiki/plugins/editsection/views.py @@ -119,8 +119,7 @@ class EditSection(EditView): kwargs['content'] = request.session.get('editSection_content') self.orig_section = kwargs.get('content') - return super(EditSection, self).dispatch( - request, article, *args, **kwargs) + return super(EditSection, self).dispatch(request, article, *args, **kwargs) def form_valid(self, form): super(EditSection, self).form_valid(form) diff --git a/tests/settings.py b/tests/settings.py index 521cf365..7ed1c1e8 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -32,7 +32,7 @@ INSTALLED_APPS = [ 'sorl.thumbnail', 'wiki.apps.WikiConfig', 'wiki.plugins.attachments.apps.AttachmentsConfig', - 'wiki.plugins.editsection.apps.AttachmentsConfig', + 'wiki.plugins.editsection.apps.EditSectionConfig', 'wiki.plugins.notifications.apps.NotificationsConfig', 'wiki.plugins.images.apps.ImagesConfig', 'wiki.plugins.macros.apps.MacrosConfig', -- 2.45.2