From 9d612b0d9839e35b4e965b42d39728b0aff0148c Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Fri, 7 Oct 2005 09:56:33 +0000 Subject: [PATCH] Commit Jean-Paul Smets changes. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3976 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Image.py | 5 +++++ product/ERP5OOo/OOoUtils.py | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py index 1d95a5c427..47a2affc94 100755 --- a/product/ERP5/Document/Image.py +++ b/product/ERP5/Document/Image.py @@ -127,3 +127,8 @@ class Image (Base, CMFPhoto): def manage_upload(self, file='', REQUEST=None): self.manage_file_upload(self, file=file, REQUEST=None) + # DAV Support + PUT = CMFPhoto.PUT + manage_FTPget = CMFPhoto.manage_FTPget + manage_FTPlist = CMFPhoto.manage_FTPlist + manage_FTPstat = CMFPhoto.manage_FTPstat diff --git a/product/ERP5OOo/OOoUtils.py b/product/ERP5OOo/OOoUtils.py index 41bfeefcb8..b6c15b1bd0 100755 --- a/product/ERP5OOo/OOoUtils.py +++ b/product/ERP5OOo/OOoUtils.py @@ -66,6 +66,7 @@ class OOoBuilder: security.declarePrivate('__init__') def __init__(self, document): self._document = StringIO(document.data) + self._image_count = 0 security.declarePublic('replace') def replace(self, filename, stream): @@ -80,6 +81,16 @@ class OOoBuilder: zf.writestr(filename, stream) zf.close() + def addImage(self, image, format='png'): + """ + Add an image to the current document and return its id + """ + count = self._image_count + self._image_count += 1 + name = "Picture/%s.%s" % (count, format) + self.replace(name, image) + return "#%s" % name + security.declarePublic('render') def render(self, name='', extension='sxw'): """ -- 2.30.9