# HG changeset patch # User Thierry Florac # Date 1553615246 -3600 # Node ID 95f7277fa50065880d27d459444e28ab829816aa # Parent 1a307e6b943288c2f60f91ee3567f7ec1b538271 Added IBasicIllustration adapter for IImage diff -r 1a307e6b9432 -r 95f7277fa500 src/pyams_content/component/illustration/__init__.py --- a/src/pyams_content/component/illustration/__init__.py Tue Mar 26 12:33:58 2019 +0100 +++ b/src/pyams_content/component/illustration/__init__.py Tue Mar 26 16:47:26 2019 +0100 @@ -217,3 +217,26 @@ """Illustration renderers vocabulary""" content_interface = IIllustration + + +# +# Custom image file to illustration adapter +# + +@adapter_config(context=IImage, provides=IBasicIllustration) +class VirtualIllustration(object): + """Virtual illustration based on image file""" + + title = None + alt_title = None + author = None + + def __init__(self, source): + self.source = source + + @property + def data(self): + return self.source + + def has_data(self): + return bool(self.source)