src/pyams_content/component/illustration/__init__.py
changeset 206 90e3fa165ce1
parent 140 67bad9f880ee
child 249 990a1e45f07c
--- a/src/pyams_content/component/illustration/__init__.py	Thu Oct 12 22:32:05 2017 +0200
+++ b/src/pyams_content/component/illustration/__init__.py	Fri Oct 13 08:13:10 2017 +0200
@@ -51,7 +51,9 @@
     description = FieldProperty(IIllustration['description'])
     author = FieldProperty(IIllustration['author'])
     _data = I18nFileProperty(IIllustration['data'])
+    filename = FieldProperty(IIllustration['filename'])
     renderer = FieldProperty(IIllustration['renderer'])
+    language = FieldProperty(IIllustration['language'])
 
     @property
     def data(self):
@@ -90,9 +92,11 @@
             info = IFileInfo(data)
             info.title = II18n(illustration).get_attribute('title', lang, request)
             info.description = II18n(illustration).get_attribute('alt_title', lang, request)
-        for lang, data in (illustration.data or {}).items():
-            if data is not None:
-                IFileInfo(data).language = lang
+            if not illustration.filename:
+                illustration.filename = info.filename
+            else:
+                info.filename = illustration.filename
+            info.language = illustration.language
 
 
 @subscriber(IObjectAddedEvent, context_selector=IIllustration)