Commit 86c5ce7e authored by Jérome Perrin's avatar Jérome Perrin

ImageField: support image as Pdata

parent b229ea94
...@@ -31,6 +31,7 @@ from Products.Formulator import Widget, Validator ...@@ -31,6 +31,7 @@ from Products.Formulator import Widget, Validator
from Products.Formulator.Field import ZMIField from Products.Formulator.Field import ZMIField
from Products.Formulator.DummyField import fields from Products.Formulator.DummyField import fields
from OFS.Image import Image as OFSImage from OFS.Image import Image as OFSImage
from OFS.Image import Pdata
from lxml.etree import Element from lxml.etree import Element
from lxml import etree from lxml import etree
import re import re
...@@ -156,7 +157,7 @@ class ImageFieldWidget(Widget.TextWidget): ...@@ -156,7 +157,7 @@ class ImageFieldWidget(Widget.TextWidget):
# is displayed in the form as a thumbnail, it will be added in the odg # is displayed in the form as a thumbnail, it will be added in the odg
# document as thumbnail size/quality # document as thumbnail size/quality
content_type, image_data = image_object.convert(**image_parameter_dict) content_type, image_data = image_object.convert(**image_parameter_dict)
if isinstance(image_data, str): if isinstance(image_data, (basestring, Pdata)):
image = OFSImage('', '', image_data) image = OFSImage('', '', image_data)
else: else:
image = image_data image = image_data
......
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