Commit 9d612b0d authored by Romain Courteaud's avatar Romain Courteaud

Commit Jean-Paul Smets changes.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3976 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f31994e1
...@@ -127,3 +127,8 @@ class Image (Base, CMFPhoto): ...@@ -127,3 +127,8 @@ class Image (Base, CMFPhoto):
def manage_upload(self, file='', REQUEST=None): def manage_upload(self, file='', REQUEST=None):
self.manage_file_upload(self, file=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
...@@ -66,6 +66,7 @@ class OOoBuilder: ...@@ -66,6 +66,7 @@ class OOoBuilder:
security.declarePrivate('__init__') security.declarePrivate('__init__')
def __init__(self, document): def __init__(self, document):
self._document = StringIO(document.data) self._document = StringIO(document.data)
self._image_count = 0
security.declarePublic('replace') security.declarePublic('replace')
def replace(self, filename, stream): def replace(self, filename, stream):
...@@ -80,6 +81,16 @@ class OOoBuilder: ...@@ -80,6 +81,16 @@ class OOoBuilder:
zf.writestr(filename, stream) zf.writestr(filename, stream)
zf.close() 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') security.declarePublic('render')
def render(self, name='', extension='sxw'): def render(self, name='', extension='sxw'):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment