Commit 9b17886d authored by Sven Franck's avatar Sven Franck

erp5_corporate_identity: handle missing images explicitly

parent a51feaa0
...@@ -12,6 +12,7 @@ Upgrade image for the specific type of display ...@@ -12,6 +12,7 @@ Upgrade image for the specific type of display
# img_svg_format display image as svg (default png/None) # img_svg_format display image as svg (default png/None)
import re import re
from OFS.Traversable import NotFound
if img_string == None or img_string == "": if img_string == None or img_string == "":
return img_string return img_string
...@@ -20,8 +21,9 @@ img_src = re.findall("src=['\"](.*?)['\"]", img_string)[0] ...@@ -20,8 +21,9 @@ img_src = re.findall("src=['\"](.*?)['\"]", img_string)[0]
img_obj = context.restrictedTraverse(img_src.split("?")[0]) img_obj = context.restrictedTraverse(img_src.split("?")[0])
img_type = img_obj.getContentType() img_type = img_obj.getContentType()
# XXX flag broken link # flag broken link until further notice
# if img_obj is None: if img_obj is None:
raise NotFound('The following image could not be found in erp5: %s' % (img_src.split("?")[0]))
# ensure alt attributes are set # ensure alt attributes are set
if img_string.find('alt=') == -1: if img_string.find('alt=') == -1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment