Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
b059a35a
Commit
b059a35a
authored
Apr 10, 2013
by
Lingnan Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the new interface to take the list of the file name
parent
6c25fbce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
product/ERP5OOo/Document/OOoDocument.py
product/ERP5OOo/Document/OOoDocument.py
+32
-0
No files found.
product/ERP5OOo/Document/OOoDocument.py
View file @
b059a35a
...
...
@@ -44,6 +44,7 @@ from Products.ERP5.Document.Document import Document, \
from
Products.ERP5.Document.Image
import
getDefaultImageQuality
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
zLOG
import
LOG
,
ERROR
from
json
import
dumps
# Mixin Import
from
Products.ERP5.mixin.base_convertable
import
BaseConvertableFileMixin
...
...
@@ -282,6 +283,34 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
data = self.Presentation_renderWithNavigation(data=self._stripHTML(html=data)).encode('
utf
-
8
')
return data
def getPresentationFileNameList(self, **kw):
"""
The start presentation page is different from the html of
other iframe
"""
if not self.hasData():
return '
text
/
plain
', ''
format ="html"
original_format = format
allowed_format_list = self.getTargetFormatList()
format_list = [x for x in allowed_format_list
if x.startswith('
html
') or x.endswith('
html
')]
format = format_list[0]
# Do real conversion
mime, data = self._getConversionFromProxyServer(format)
# Extra processing required since
# we receive a zip file
cs = cStringIO.StringIO()
cs.write(str(data))
z = zipfile.ZipFile(cs) # A disk file would be more RAM efficient
mime = '
text
/
html
'
file_name_list = self._populateConversionCacheWithHTML(zip_file=z, **kw) # Maybe some parts should be asynchronous for
# better usability
z.close()
cs.close()
return dumps(file_name_list)
# Conversion API
def _convert(self, format, frame=0, **kw):
"""Convert the document to the given format.
...
...
@@ -403,6 +432,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
must_close
=
1
else
:
must_close
=
0
file_name_list
=
[]
for
f
in
zip_file
.
infolist
():
filename
=
f
.
filename
document
=
self
.
get
(
filename
,
None
)
...
...
@@ -417,6 +447,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
zip_file
.
read
(
filename
),
object
=
self
,
context
=
self
,
mimetype
=
mime
)
file_name_list
.
append
(
filename
)
else
:
mime
=
guess_content_type
(
filename
)[
0
]
data
=
Pdata
(
zip_file
.
read
(
filename
))
...
...
@@ -426,6 +457,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
if
must_close
:
zip_file
.
close
()
archive_file
.
close
()
return
file_name_list
security
.
declarePrivate
(
'_convertToBaseFormat'
)
def
_convertToBaseFormat
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment