← Back to team overview

openerp-community team mailing list archive

Re: how to get ir.attachment instance as a file-like object?

 

On 12-09-11 20:00, Viktor Nagy wrote:
Hi,

I'm building a wrapper-addon for hylafax (lp:~toolpart/openobject-addons/sendfax), and would need a simple way to get back ir.attachment objects as file-like objects (actually, I just need a read method.

Could someone post me a way to do it, please?


Hi Victor,

"import base64" at the top of your script and then

    file_data = base64.decodestring(attachment_id.datas)

Cheers,
Stefan.


--
Therp - Maatwerk in open ontwikkeling

Stefan Rijnhart - Ontwerp en implementatie

mail: stefan@xxxxxxxx
tel: +31 (0) 614478606
web: http://therp.nl



References