openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #08048
[Bug 940263] [NEW] [6.1 trunk] report engine generates inconsistent odt/sxw files
Public bug reported:
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
** Affects: openobject-server
Importance: Undecided
Status: New
** Tags: mso
--
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 trunk] 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
Follow ups
References