diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py index f9683e60f0402eba03d4b288c6e606258e810d28..120e4f362ce4c906979d07b09d8994bdc2d49877 100644 --- a/product/ERP5/Document/Document.py +++ b/product/ERP5/Document/Document.py @@ -1090,7 +1090,8 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): else: stripped_html = html # find charset and convert to utf-8 - charset_list = self.charset_parser.findall(str(html)) + charset_list = self.charset_parser.findall(str(html)) # XXX - Not efficient is datastream + # instance but hard to do better if charset_list: stripped_html = unicode(stripped_html, charset_list[0]).encode('utf-8') return stripped_html diff --git a/product/ERP5/Document/TextDocument.py b/product/ERP5/Document/TextDocument.py index e6a9d8296b2155e4be1ce2aebe5aefb49809cb3e..c94283a37e01a7e75fa58359bd98d4c82d9c31ea 100644 --- a/product/ERP5/Document/TextDocument.py +++ b/product/ERP5/Document/TextDocument.py @@ -135,7 +135,8 @@ class TextDocument(Document, TextContent): # The default is to use ERP5 Forms to render the page return self.view() mime, data = self.convert(format=format) - RESPONSE.setHeader('Content-Length', len(data)) + RESPONSE.setHeader('Content-Length', len(str(data))) # XXX - Not efficient + # if datastream instance RESPONSE.setHeader('Content-Type', mime) RESPONSE.setHeader('Accept-Ranges', 'bytes') return data @@ -181,7 +182,7 @@ class TextDocument(Document, TextContent): if base_list: return base_list[0] return Document.getContentBaseURL(self) - + def hasBaseData(self): """ This method is an override of dynamically generated method for Document class.