[Erp5-dev] storing binary data in content objects

bartek bartek at erp5.pl
Tue Nov 20 12:32:45 CET 2007


Hello

I tried to use the content storage mechanism - the one that works so 
nicely for email, phone number, career etc - to store a picture (e.g. an 
image of a person). Tried to define a property normally:

         { 'id'                       : 'picture'
         , 'storage_id'               : 'default_picture'
         , 'description'              : 'The current picture of the person'
         , 'type'                     : 'content'
         , 'portal_type'              : ( 'Image', )
         , 'acquired_property_id'     : ( 'file', 'data')
         , 'mode'                     : 'w'
         },

and added a FileField named "my_picture_file" or 
"my_default_picture_file" to a Person_view form.

But it doesn't work as expected - when I upload a file to a Person 
object, the system creates an Image object named "default_picture" but 
the "data" attribute of the Image contains file name instead of data.

And I'm confused - I thought that ERP5 would create a content object and 
just pass on what it received to the object's setter method, but 
apparently it does something else in the meantime. Any hint?

Bartek

-- 
"feelings affect productivity. (...) unhappy people write worse 
software, and less of it."
Karl Fogel, "Producing Open Source Software"



More information about the Erp5-dev mailing list