def at_store(self, context, image_infos, field_name="image"):
     """Do the job to fetch image and update the context with it"""
     sio = StringIO()
     sio.write(image_infos["data"])
     field = context.getField(field_name) or context.getPrimaryField()
     field.set(
         context,
         image_infos["data"],
         mimetype=image_infos["mimetype"],
         filename=image_infos["filename"],
         refresh_exif=False,
     )
     notify(ObjectEditedEvent(context))
     IStatusMessage(self.request).addStatusMessage(_("Your image has been updated."), "info")
 def link_infos(self):
     return {"icon": self.get_ico, "title": _("Edit with %s.") % self.name, "url": self.edit_url}
from plone.app.registry.browser.controlpanel import RegistryEditForm
from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper

from collective.externalimageeditor import MessageFactory as _
from collective.externalimageeditor.interfaces import IExternalimageeditorConfiguration
from plone.z3cform import layout

class PanelForm(RegistryEditForm):
    schema = IExternalimageeditorConfiguration

ControlPanelView = layout.wrap_form(PanelForm, ControlPanelFormWrapper)
ControlPanelView.label = _(u"Externalimagerditor settings")