[CMF-checkins] CVS: CMF/CMFDefault - Document.py:1.52.10.1
Yvo Schubbe
schubbe@web.de
Sun, 2 Feb 2003 08:40:07 -0500
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv18204/CMFDefault
Modified Files:
Tag: yuppie-collector041-branch
Document.py
Log Message:
first step:
- simplified code (this should not change any behaviour)
=== CMF/CMFDefault/Document.py 1.52 => 1.52.10.1 ===
--- CMF/CMFDefault/Document.py:1.52 Thu Oct 17 15:38:35 2002
+++ CMF/CMFDefault/Document.py Sun Feb 2 08:40:05 2003
@@ -1,14 +1,15 @@
##############################################################################
#
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+# Copyright (c) 2001-2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
""" Basic textual content object, supporting both HTML and STX.
@@ -210,9 +211,7 @@
headers.update(parser.metatags)
if parser.title:
headers['Title'] = parser.title
- bodyfound = bodyfinder(text)
- if bodyfound:
- body = bodyfound
+ body = bodyfinder(text)
else:
headers, body = parseHeadersBody(text, headers)
self._stx_level = level
@@ -346,15 +345,16 @@
self.dav__init(REQUEST, RESPONSE)
self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
body = REQUEST.get('BODY', '')
- guessedformat = REQUEST.get_header('Content-Type', 'text/plain')
- ishtml = (guessedformat == 'text/html') or utils.html_headcheck(body)
-
- if ishtml: self.setFormat('text/html')
- else: self.setFormat('text/plain')
+ if REQUEST.get_header('Content-Type', '') == 'text/html':
+ text_format = 'html'
+ else:
+ text_format = None
try:
- headers, body, format = self.handleText(text=body)
- safety_belt = headers.get('SafetyBelt', '')
+ headers, body, text_format = self.handleText(text=body,
+ format=text_format)
+ safety_belt = headers.get('SafetyBelt', '')
+ self.setFormat(value=text_format)
self.setMetadata(headers)
self._edit(text=body, safety_belt=safety_belt)
except 'EditingConflict', msg: