From edd96b6dc67564e6a7455bde4b054e3fbc11aa79 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 7 May 2017 04:51:51 +0200 Subject: [PATCH 1/5] Fix failures in menu tests --- tests/test_menu.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_menu.py b/tests/test_menu.py index 4c11398..cb4ad05 100644 --- a/tests/test_menu.py +++ b/tests/test_menu.py @@ -45,6 +45,7 @@ class MenuTest(BaseTest): for lang in ('en', 'it'): with smart_override(lang): + self._reset_menus() request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang)) nodes = menu_pool.get_nodes(request) nodes_url = set([node.url for node in nodes]) @@ -55,6 +56,7 @@ class MenuTest(BaseTest): posts[0].categories.clear() for lang in ('en', 'it'): with smart_override(lang): + self._reset_menus() request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang)) nodes = menu_pool.get_nodes(request) nodes_url = set([node.url for node in nodes]) @@ -75,6 +77,7 @@ class MenuTest(BaseTest): for lang in languages: with smart_override(lang): + self._reset_menus() cats_url[lang] = set([cat.get_absolute_url() for cat in self.cats if cat.has_translation(lang)]) posts_url[lang] = set([post.get_absolute_url(lang) for post in posts if post.has_translation(lang) and post.app_config == self.app_config_1]) @@ -85,6 +88,7 @@ class MenuTest(BaseTest): for lang in languages: request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang) with smart_override(lang): + self._reset_menus() nodes = menu_pool.get_nodes(request) nodes_url = set([node.url for node in nodes]) self.assertFalse(cats_url[lang].issubset(nodes_url)) @@ -97,6 +101,7 @@ class MenuTest(BaseTest): for lang in languages: request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang) with smart_override(lang): + self._reset_menus() nodes = menu_pool.get_nodes(request) nodes_url = set([node.url for node in nodes]) self.assertFalse(cats_url[lang].issubset(nodes_url)) @@ -109,6 +114,7 @@ class MenuTest(BaseTest): for lang in languages: request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang) with smart_override(lang): + self._reset_menus() nodes = menu_pool.get_nodes(request) nodes_url = set([node.url for node in nodes]) self.assertTrue(cats_url[lang].issubset(nodes_url)) @@ -121,6 +127,7 @@ class MenuTest(BaseTest): for lang in languages: request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang) with smart_override(lang): + self._reset_menus() nodes = menu_pool.get_nodes(request) nodes_url = set([node.url for node in nodes]) self.assertTrue(cats_url[lang].issubset(nodes_url)) From 0440c7a79447c5443d02fdac0991280e8179f2ea Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 6 Jun 2017 21:46:00 +0200 Subject: [PATCH 2/5] Drop Python 2.6 compatibility --- .travis.yml | 2 -- HISTORY.rst | 6 ++++++ tox.ini | 4 +--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index beb8d7f..70d0caf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ python: - 3.4 - 3.3 - 2.7 - - 2.6 env: matrix: @@ -33,7 +32,6 @@ env: # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors install: - - "if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then export PYVER=py26; fi" - "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then export PYVER=py27; fi" - "if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then export PYVER=py33; fi" - "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export PYVER=py34; fi" diff --git a/HISTORY.rst b/HISTORY.rst index e9c2e0e..24559b8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,12 @@ History ======= +******************* +0.8.13 (unreleased) +******************* + +* Drop python 2.6 compatibility + ******************* 0.8.12 (2017-03-11) ******************* diff --git a/tox.ini b/tox.ini index 7e213ad..b0e827e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,9 @@ [tox] -envlist = pep8,isort,py{35,34,27}-django{19}-{cms34,cms33,cms32,knocker},py{35,34,33,27}-django{18}-cms{34,33,32,31},py{34,33,27}-django{17,16}-cms{32,31,30},py{26}-django16-cms{31,30} +envlist = pep8,isort,py{35,34,27}-django{19}-{cms34,cms33,cms32,knocker},py{35,34,33,27}-django{18}-cms{34,33,32,31},py{34,33,27}-django{17,16}-cms{32,31,30} [testenv] commands = {env:COMMAND:python} cms_helper.py test djangocms_blog deps = - py26: unittest2 - py26: Pillow<4.0 django16: Django>=1.6,<1.7 django16: django-taggit<0.18 django16: django-mptt<0.8 From 902ad5df4aa3d2ed677a145db8e4356bee6e41dd Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 6 Jun 2017 22:36:30 +0200 Subject: [PATCH 3/5] Removed obsolete compatibility code --- djangocms_blog/managers.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/djangocms_blog/managers.py b/djangocms_blog/managers.py index 8cf5a73..004d383 100644 --- a/djangocms_blog/managers.py +++ b/djangocms_blog/managers.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals -import django +from collections import Counter + from aldryn_apphooks_config.managers.parler import ( AppHookConfigTranslatableManager, AppHookConfigTranslatableQueryset, ) @@ -9,11 +10,6 @@ from django.contrib.sites.models import Site from django.db import models from django.utils.timezone import now -try: - from collections import Counter -except ImportError: - from .compat import Counter - class TaggedFilterItem(object): @@ -129,12 +125,7 @@ class GenericDateTaggedManager(TaggedFilterItem, AppHookConfigTranslatableManage queryset_class = GenericDateQuerySet def get_queryset(self, *args, **kwargs): - try: - return super(GenericDateTaggedManager, self).get_queryset(*args, **kwargs) - except AttributeError: # pragma: no cover - return super(GenericDateTaggedManager, self).get_query_set(*args, **kwargs) - if django.VERSION < (1, 8): - get_query_set = get_queryset + return super(GenericDateTaggedManager, self).get_queryset(*args, **kwargs) def published(self): return self.get_queryset().published() From 1809354573c0fcf1ad6bf55a8c9bc7e66b4dd4a7 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 6 Jun 2017 07:05:50 +0200 Subject: [PATCH 4/5] Fixed exceptions in __str__ --- HISTORY.rst | 1 + djangocms_blog/models.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 24559b8..cab8140 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,7 @@ History ******************* * Drop python 2.6 compatibility +* Fixed exceptions in __str__ ******************* 0.8.12 (2017-03-11) diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 44b3545..7f09194 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -98,7 +98,7 @@ class BlogCategory(TranslatableModel): ) def __str__(self): - return self.safe_translation_getter('name') + return self.safe_translation_getter('name', any_language=True) def save(self, *args, **kwargs): super(BlogCategory, self).save(*args, **kwargs) @@ -203,7 +203,7 @@ class Post(KnockerModel, ModelMeta, TranslatableModel): get_latest_by = 'date_published' def __str__(self): - return self.safe_translation_getter('title') + return self.safe_translation_getter('title', any_language=True) @property def guid(self, language=None): From 92c353d1f6998fded58812923056736b26b480f5 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 6 Jun 2017 21:46:00 +0200 Subject: [PATCH 5/5] Drop Python 2.6 compatibility --- HISTORY.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.rst b/HISTORY.rst index cab8140..0eaa66f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,6 +10,7 @@ History * Drop python 2.6 compatibility * Fixed exceptions in __str__ +* Drop python 2.6 compatibility ******************* 0.8.12 (2017-03-11)