openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #00556
Re: how to get ir.attachment instance as a file-like object?
-
To:
openerp-community@xxxxxxxxxxxxxxxxxxx
-
From:
Stefan Rijnhart <stefan@xxxxxxxx>
-
Date:
Fri, 16 Sep 2011 14:22:10 +0200
-
In-reply-to:
<CAGUoFRbRBt9=9y6Hb1CesWM1a6f+zbCveq2KiE_yfXKxuxrE5A@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13
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