From 97f374377117c9bfac6fe9153a43006b79c16507 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sat, 9 Apr 2016 07:25:27 +0200 Subject: [PATCH] Reuse _get_meta_value from django-meta --- djangocms_blog/models.py | 16 +--------------- setup.py | 2 +- tox.ini | 2 +- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 722f2bb..752dd5d 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -236,21 +236,7 @@ class Post(KnockerModel, ModelMeta, TranslatableModel): Retrieves django-meta attributes from apphook config instance :param param: django-meta attribute passed as key """ - attr = None - value = getattr(self.app_config, param) - if value: - attr = getattr(self, value, None) - if attr is not None: - if callable(attr): - try: - data = attr(param) - except TypeError: - data = attr() - else: - data = attr - else: - data = value - return data + return self._get_meta_value(param, getattr(self.app_config, param)) or '' def get_title(self): title = self.safe_translation_getter('meta_title', any_language=True) diff --git a/setup.py b/setup.py index e847575..7ad11ea 100755 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( 'django-taggit-autosuggest', 'djangocms-text-ckeditor', 'cmsplugin-filer', - 'django-meta>=1.1', + 'django-meta>=1.2', 'aldryn-apphooks-config>=0.2.6', 'djangocms-apphook-setup', 'aldryn-search' diff --git a/tox.ini b/tox.ini index b9a67dd..52d7aa7 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,7 @@ deps = cms32: https://github.com/divio/django-cms/archive/release/3.2.x.zip knocker: https://github.com/divio/django-cms/archive/release/3.2.x.zip knocker: https://github.com/nephila/django-knocker/archive/master.zip?0.1.1 - django-meta>=1.0b3 + django-meta>=1.2 https://github.com/nephila/djangocms-helper/archive/develop.zip py26: unittest2 https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip