Commit ae32ee26 authored by Bartek Górny's avatar Bartek Górny

don't try to generate html preview if the doc has no data; updated a comment...

don't try to generate html preview if the doc has no data; updated a comment (the 'do until content' is not there anymore')

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14625 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bc061057
...@@ -965,7 +965,7 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): ...@@ -965,7 +965,7 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
fallback_script_id = 'Document_getPreferredDocumentMetadataDiscoveryOrderList') fallback_script_id = 'Document_getPreferredDocumentMetadataDiscoveryOrderList')
order_list = list(method()) order_list = list(method())
order_list.reverse() order_list.reverse()
# Start with everything until content - build a dictionary according to the order # build a dictionary according to the order
kw = {} kw = {}
for order_id in order_list: for order_id in order_list:
result = None result = None
...@@ -1071,6 +1071,8 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): ...@@ -1071,6 +1071,8 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
A private method which converts to HTML. This method A private method which converts to HTML. This method
is the one to override in subclasses. is the one to override in subclasses.
""" """
if not self.getData():
return ''
if self.hasConversion(format='base-html'): if self.hasConversion(format='base-html'):
mime, data = self.getConversion(format='base-html') mime, data = self.getConversion(format='base-html')
return data return data
...@@ -1084,6 +1086,8 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): ...@@ -1084,6 +1086,8 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
(without html and body tags, etc.) which can be used to inline (without html and body tags, etc.) which can be used to inline
a preview of the document. a preview of the document.
""" """
if not self.getData():
return ''
if self.hasConversion(format='stripped-html'): # XXX this is redundant since we never set it if self.hasConversion(format='stripped-html'): # XXX this is redundant since we never set it
mime, data = self.getConversion(format='stripped-html') mime, data = self.getConversion(format='stripped-html')
return data return data
......
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