← Back to team overview

openerp-india team mailing list archive

[Bug 940263] Re: [6.1] report engine generates inconsistent odt/sxw files

 

** Branch linked: lp:~openerp-dev/openobject-server/6.0-opw-572488-rha

-- 
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