--- a/src/pyams_content/component/theme/__init__.py Fri Nov 10 11:46:51 2017 +0100
+++ b/src/pyams_content/component/theme/__init__.py Fri Nov 10 11:47:23 2017 +0100
@@ -16,12 +16,14 @@
# import standard library
# import interfaces
-from pyams_content.component.theme.interfaces import IThemesManagerTarget, IThemesManager, THEMES_MANAGER_KEY, IThemesInfo, \
- IThemesTarget, THEMES_INFO_KEY
+from pyams_content.component.theme.interfaces import IThemesManagerTarget, IThemesManager, THEMES_MANAGER_KEY, \
+ IThemesTarget, IThemesInfo, THEMES_INFO_KEY
+from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE
from zope.annotation.interfaces import IAnnotations
# import packages
from persistent import Persistent
+from pyams_content.features.checker import BaseContentChecker
from pyams_utils.adapter import adapter_config
from pyramid.threadlocal import get_current_registry
from zope.container.contained import Contained
@@ -30,6 +32,8 @@
from zope.location import locate
from zope.schema.fieldproperty import FieldProperty
+from pyams_content import _
+
@implementer(IThemesManager)
class ThemesManager(Persistent, Contained):
@@ -68,3 +72,20 @@
get_current_registry().notify(ObjectCreatedEvent(info))
locate(info, target, '++themes++')
return info
+
+
+@adapter_config(name='themes', context=IThemesTarget, provides=IContentChecker)
+class ThemesContentChecker(BaseContentChecker):
+ """Themes info content checker"""
+
+ label = _("Themes")
+ weight = 200
+
+ def inner_check(self, request):
+ output = []
+ translate = request.localizer.translate
+ themes = IThemesInfo(self.context)
+ if not themes.themes:
+ output.append(translate(ERROR_VALUE).format(field=translate(IThemesInfo['themes'].title),
+ message=translate(_("no defined theme"))))
+ return output