Commit bade10f8 authored by Aurel's avatar Aurel

File: convert str fo file_object if needed

parent 14f54456
......@@ -36,6 +36,7 @@ from erp5.component.document.Document import ConversionError
from Products.ERP5Type.Base import Base, removeIContentishInterface
from OFS.Image import File as OFS_File
from Products.ERP5Type.Utils import deprecated
from cStringIO import StringIO
def _unpackData(data):
"""
......@@ -111,6 +112,8 @@ class File(Document, OFS_File):
if filename:
self._setFilename(filename)
if file_object is not None:
if isinstance(file_object, str):
file_object = StringIO(file_object)
# XXX: Rather than doing nothing if empty, consider changing:
# - _update_image_info to clear metadata
# - interactions to do nothing (or else?)
......
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