Commit 9cc1e827 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Improvements for populateContent

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19207 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a984e17c
...@@ -411,7 +411,8 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -411,7 +411,8 @@ class OOoDocument(File, ConversionCacheMixin):
data = z.read(fn) data = z.read(fn)
break break
mime = 'text/html' mime = 'text/html'
self.populateContent(zip_file=z) self.populateContent(zip_file=z) # Maybe some parts should be asynchronous for
# better usability
z.close() z.close()
cs.close() cs.close()
if (display is None or original_format not in STANDARD_IMAGE_FORMAT_LIST) \ if (display is None or original_format not in STANDARD_IMAGE_FORMAT_LIST) \
...@@ -474,13 +475,24 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -474,13 +475,24 @@ class OOoDocument(File, ConversionCacheMixin):
self.manage_delObjects([file_name]) self.manage_delObjects([file_name])
newContent = UnrestrictedMethod(self.portal_contributions.newContent) newContent = UnrestrictedMethod(self.portal_contributions.newContent)
if file_name.endswith('html'): if file_name.endswith('html'):
newContent(id=file_name, container=self, portal_type='Web Page', web_page = newContent(\
id=file_name, container=self, portal_type='Web Page',
file_name=file_name, file_name=file_name,
data=zip_file.read(file_name)) data=zip_file.read(file_name))
if web_page.getValidationState() != 'embedded':
# Make sure embedded is set until cleaner solution if found
web_page.embed()
web_page.activate().disoverMetadata() # Maybe we should use contribution tool instead
# Should be embedded
else: else:
newContent(id=file_name, container=self, image_or_file = newContent(\
id=file_name, container=self,
portal_type='Image', # Contribution Tool would be better here
file_name=file_name, file_name=file_name,
data=zip_file.read(file_name)) data=zip_file.read(file_name))
if image_or_file.getValidationState() != 'embedded':
# Make sure embedded is set until cleaner solution if found
image_or_file.embed()
if must_close: if must_close:
zip_file.close() zip_file.close()
archive_file.close() archive_file.close()
......
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