openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #09078
[Bug 940263] Re: [6.1] report engine generates inconsistent odt/sxw files
** Attachment added: "odt-sxw.ogv"
https://bugs.launchpad.net/openobject-server/+bug/940263/+attachment/2880954/+files/odt-sxw.ogv
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/940263
Title:
[6.1] report engine generates inconsistent odt/sxw files
Status in OpenERP Server:
New
Bug description:
Hi,
In report_sxw, you cannot call writestr to replace a file in an
archive. You must first remove the file from the archive otherwise you
end up with multiple times the same file in the archive and
unpredictable result when reading the file.
This can be performed by creating a new archive without the file you
want to replace, e.g. (not tested):
add={'content.xml':data, .... }
zin = zipfile.ZipFile ('archive.zip', 'r')
zout = zipfile.ZipFile ('archve_new.zip', 'w')
for item in zin.infolist():
buffer = zin.read(item.filename):
if (item.filename not in add.keys()):
zout.writestr(item, buffer)
for item,buffer in add.iteritem():
zout.writestr(item, buffer)
zin.close()
zout.close()
J-E
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/940263/+subscriptions
References