Added illustration's "has_data" method to check is illustration is provided for at least one language
--- a/src/pyams_content/component/illustration/__init__.py Fri Jun 15 11:03:03 2018 +0200
+++ b/src/pyams_content/component/illustration/__init__.py Fri Jun 15 11:03:40 2018 +0200
@@ -66,6 +66,14 @@
if IImage.providedBy(data):
alsoProvides(data, IResponsiveImage)
+ def has_data(self):
+ if not self._data:
+ return False
+ for data in self._data.values():
+ if bool(data):
+ return True
+ return False
+
@adapter_config(context=IBasicIllustrationTarget, provides=IIllustration)
def basic_illustration_factory(context):
--- a/src/pyams_content/component/illustration/interfaces/__init__.py Fri Jun 15 11:03:03 2018 +0200
+++ b/src/pyams_content/component/illustration/interfaces/__init__.py Fri Jun 15 11:03:40 2018 +0200
@@ -45,6 +45,9 @@
description=_("Image or video content"),
required=False)
+ def has_data(self):
+ """Check if data is provided in any language"""
+
title = I18nTextLineField(title=_("Legend"),
required=False)