Added check in widget's prefix
authorThierry Florac <thierry.florac@onf.fr>
Tue, 23 Oct 2018 15:51:01 +0200
changeset 1033 6ca1041099d3
parent 1032 a8f638406ed5
child 1034 87f03e244266
Added check in widget's prefix
src/pyams_content/component/extfile/zmi/widget.py
--- a/src/pyams_content/component/extfile/zmi/widget.py	Tue Oct 23 12:14:53 2018 +0200
+++ b/src/pyams_content/component/extfile/zmi/widget.py	Tue Oct 23 15:51:01 2018 +0200
@@ -9,8 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_i18n.interfaces.widget import II18nTextLineWidget
-
 
 __docformat__ = 'restructuredtext'
 
@@ -23,6 +21,7 @@
 from pyams_form.interfaces import IFormLayer
 from pyams_form.widget import widgettemplate_config
 from pyams_i18n.interfaces import II18n
+from pyams_i18n.interfaces.widget import II18nTextLineWidget
 from pyams_i18n.widget import I18nTextLineWidget
 
 
@@ -46,8 +45,11 @@
         if manager_info is not None:
             lang = getattr(self, 'lang', None)  # I18n widget
             if lang is not None:
-                return manager_info.default_title_prefix.get(lang, '') or ''
-        return II18n(manager_info).query_attribute('default_title_prefix', request=self.request) or ''
+                return (manager_info.default_title_prefix or {}).get(lang, '') or ''
+            else:
+                return II18n(manager_info).query_attribute('default_title_prefix', request=self.request) or ''
+        else:
+            return ''
 
 
 def ExtFileTitleFieldWidget(field, request):