diff --git a/product/ERP5Type/WebDAVSupport.py b/product/ERP5Type/WebDAVSupport.py index 64eb6fb39998e93e13eff2491caacc2fe93fde39..1223c9dbc49e270aee4cb2afddcc2c3db8145278 100644 --- a/product/ERP5Type/WebDAVSupport.py +++ b/product/ERP5Type/WebDAVSupport.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2005 Nexedi SARL. All Rights Reserved. @@ -93,8 +94,10 @@ class TextContent: security.declarePrivate('guessFormat') def guessFormat(self, text): """ Simple stab at guessing the inner format of the text """ - if html_headcheck(text): return 'html' - else: return 'structured-text' + if html_headcheck(text): + return 'text/html' + else: + return 'text/structured' security.declarePrivate('handleText') def handleText(self, text, format=None): @@ -102,7 +105,7 @@ class TextContent: headers = {} if not format: format = self.guessFormat(text) - if format == 'html': + if format == 'text/html': parser = SimpleHTMLParser() parser.feed(text) headers.update(parser.metatags) @@ -124,11 +127,8 @@ class TextContent: try: headers, body, format = self.handleText(text=body) - if REQUEST.get_header('Content-Type', '') == 'text/html': - text_format = 'html' - else: - text_format = format - if not headers.has_key('text_format'): headers['text_format'] = text_format + content_type = REQUEST.get_header('Content-Type', '') + headers.setdefault('content_type', content_type) headers['text_content'] = body self._edit(**headers) except 'EditingConflict', msg: @@ -161,7 +161,7 @@ class TextContent: hdrlist = [] for p in self.getPropertyMap(): pid = p.get('base_id', p['id']) - if pid not in ('text_content',): + if pid not in ('text_content', 'data', 'base_data'): hdrlist.append((pid, self.getProperty(p['id']))) return hdrlist @@ -187,11 +187,11 @@ class TextContent: bodytext = self._htmlsrc % { 'title': self.getTitle(), 'metatags': hdrtext, - 'body': self.getTextContent(), + 'body': self.getTextContent(''), } else: hdrtext = formatRFC822Headers( hdrlist ) - bodytext = '%s\r\n\r\n%s' % ( hdrtext, self.getTextContent() ) + bodytext = '%s\r\n\r\n%s' % ( hdrtext, self.getTextContent('') ) return bodytext