From 497ec74f2e67bda2d98c3ae7591f45818ef329f8 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 9 Jan 2018 01:08:57 +0100 Subject: [PATCH] Cleanup compatibility shims --- djangocms_blog/admin.py | 8 +------- djangocms_blog/feeds.py | 10 +++++----- djangocms_blog/search_indexes.py | 2 ++ setup.py | 1 + 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/djangocms_blog/admin.py b/djangocms_blog/admin.py index c3f5325..12570b0 100755 --- a/djangocms_blog/admin.py +++ b/djangocms_blog/admin.py @@ -24,12 +24,6 @@ from .forms import CategoryAdminForm, PostAdminForm from .models import BlogCategory, Post from .settings import get_setting -try: - from admin_enhancer.admin import EnhancedModelAdminMixin -except ImportError: - class EnhancedModelAdminMixin(object): - pass - class SiteListFilter(admin.SimpleListFilter): title = _('site') @@ -55,7 +49,7 @@ class SiteListFilter(admin.SimpleListFilter): raise admin.options.IncorrectLookupParameters(e) -class BlogCategoryAdmin(EnhancedModelAdminMixin, ModelAppHookConfig, TranslatableAdmin): +class BlogCategoryAdmin(ModelAppHookConfig, TranslatableAdmin): form = CategoryAdminForm list_display = [ 'name', 'parent', 'app_config', 'all_languages_column', diff --git a/djangocms_blog/feeds.py b/djangocms_blog/feeds.py index c55baf2..99f6adf 100644 --- a/djangocms_blog/feeds.py +++ b/djangocms_blog/feeds.py @@ -24,10 +24,10 @@ try: import HTMLParser h = HTMLParser.HTMLParser() -except ImportError: - from html.parser import HTMLParser + unescape = h.unescape - h = HTMLParser() +except ImportError: + from html import unescape class LatestEntriesFeed(Feed): @@ -123,13 +123,13 @@ class FBInstantFeed(Rss201rev2Feed): handler.startElement('description', {}) handler._write(''.format( - h.unescape(normalize_newlines(force_text(item['abstract'])).replace('\n', ' '))) + unescape(normalize_newlines(force_text(item['abstract'])).replace('\n', ' '))) ) handler.endElement('description') handler.startElement('content:encoded', {}) handler._write('') - handler._write(h.unescape(force_text(item['content']))) + handler._write(unescape(force_text(item['content']))) handler._write(']]>') handler.endElement('content:encoded') diff --git a/djangocms_blog/search_indexes.py b/djangocms_blog/search_indexes.py index 33ea1b2..daada50 100644 --- a/djangocms_blog/search_indexes.py +++ b/djangocms_blog/search_indexes.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import, print_function, unicode_literals + from aldryn_search.helpers import get_plugin_index_data from aldryn_search.utils import get_index_base, strip_tags from django.utils.encoding import force_text diff --git a/setup.py b/setup.py index c98c9e0..b5d0c69 100755 --- a/setup.py +++ b/setup.py @@ -60,6 +60,7 @@ setup( 'Framework :: Django', 'Framework :: Django :: 1.8', 'Framework :: Django :: 1.9', + 'Framework :: Django :: 1.10', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3',