[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/ZPTPage - ZPTPage.py:1.17

Christian Zagrodnick cz@gocept.com
Sat, 7 Dec 2002 11:52:20 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/ZPTPage
In directory cvs.zope.org:/tmp/cvs-serv31908

Modified Files:
	ZPTPage.py 
Log Message:
SearchableText adapter strips html tags if content-type is text/html

=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py 1.16 => 1.17 ===
--- Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py:1.16	Thu Dec  5 12:37:31 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py	Sat Dec  7 11:52:19 2002
@@ -14,6 +14,9 @@
 """
 $Id$
 """
+
+import re
+
 from Interface import Interface
 from Interface.Attribute import Attribute
 import Zope.Schema
@@ -125,4 +128,11 @@
         #   text was already Unicode, which happens, but unclear how it
         #   gets converted to Unicode since the ZPTPage stores UTF-8 as
         #   an 8-bit string.
+        
+        
+        if self.page.content_type.startswith('text/html'):
+            tag = re.compile(r"<[^>]+>")
+            text = tag.sub('', text)
+        
+           
         return [text]