On 10 Jun 05:07, Vincent Mora wrote:
> Hi,
> 
> My reporting class return a pdf document :
> 
> class MyReport(Report):
>     __name__ = 'mymodule.myreport'
> 
>     @classmethod
>     def execute(cls, ids, data):
>     # code to create myfile.pdf 
>     ...
>     pdf_buffer = None
>     with open('myfile.pdf', 'rb') as pdf:
>             pdf_buffer = pdf.read()
> 
>     return ('pdf', pdf_buffer, False, 'myreport' )

     return ('pdf', buffer(pdf_buffer), False, 'myreport' )

> 
> The problem is that json won't encode binary stuff. 
> 
> I'm trying to understand how it's done for images in odt, or odt itself 
> since its a zip file, but it's a bit tedious and I'd be grateful for some 
> help.

As str in Python could be string or binary and to prevent Tryton to
base64 every string. The convention is to use buffer to differenciate
the binary str.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgpYzI0LaLpXI.pgp
Description: PGP signature

Reply via email to