From 766488f3ef72142067534ba8754814581809f2bf Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Mon, 11 Jan 2010 14:22:46 +0000
Subject: [PATCH] Do not try to include image tags if image default field value
 is an empty string (i.e. not set). This fails physicalPathFromURL.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31679 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_odt_style/form_view.xml              | 7 ++++---
 bt5/erp5_odt_style/bt/revision                             | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/form_view.xml b/bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/form_view.xml
index 497c4f4a80..3cb43f502d 100644
--- a/bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/form_view.xml
+++ b/bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/form_view.xml
@@ -259,10 +259,11 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
                           <tal:block tal:condition="python: field_type == \'ImageField\'">\n
                             <text:p text:style-name=\'field-content\'\n
                                     tal:define="preferred_width python: preference_tool.getPreference(\'preferred_%s_image_width\' % (field.get_value(\'image_display\')), 100);\n
-                                    width python:(preferred_width  / 20.) &lt; max_size and (preferred_width / 20.) or max_size">\n
-                              <tal:block>\n
+                                    width python:(preferred_width  / 20.) &lt; max_size and (preferred_width / 20.) or max_size;\n
+                                    field_value python: field.get_value(\'default\')">\n
+                              <tal:block tal:condition="python: field_value not in (\'\', None,)">\n
                                 <office:include_img tal:attributes="width width;\n
-                                path python: \'/\'.join(request.physicalPathFromURL(field.get_value(\'default\')));"\n
+                                path python: \'/\'.join(request.physicalPathFromURL(field_value));"\n
                                 style="inline-graphic"/>\n
                               </tal:block>\n
                             </text:p>\n
diff --git a/bt5/erp5_odt_style/bt/revision b/bt5/erp5_odt_style/bt/revision
index e3f1e9b791..24af08a487 100644
--- a/bt5/erp5_odt_style/bt/revision
+++ b/bt5/erp5_odt_style/bt/revision
@@ -1 +1 @@
-80
\ No newline at end of file
+83
\ No newline at end of file
-- 
2.30.9