[CMF-checkins] CVS: CMF/CMFDefault/tests - test_Document.py:1.14

Jeffrey P Shell jeffrey@zope.com
Mon, 13 Aug 2001 17:00:19 -0400


Update of /cvs-repository/CMF/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv1690/tests

Modified Files:
	test_Document.py 
Log Message:
Fixed issue with CMFDefault.utils.bodyfinder - it was previously a full regex that could cause a Runtime error - recursion limit exceeded;  Now it is a function that uses regex match objects start() and end() data, rather than trying to swallow up the text between body tags inside the regex itself

=== CMF/CMFDefault/tests/test_Document.py 1.13 => 1.14 ===
 DOCTYPE = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'''
 
+HTML_TEMPLATE = '''\
+<html><head>
+ <title>%(title)s</title>
+</head>
+<body bgcolor="#efe843">%(body)s</body>
+</html>
+'''
+
 BASIC_HTML = '''\
 <html>
  <head>
@@ -139,6 +147,18 @@
         assert d.Format() == 'text/html'
         assert d.Description() == 'Describe me'
 
+    def test_BigHtml(self):
+        d = Document('foo')
+        s = []
+        looper = '<li> number %s</li>'
+        for i in range(12000): s.append(looper % i)
+        body = '<ul>\n%s\n</ul>' % string.join(s, '\n')
+        html = HTML_TEMPLATE % {'title': 'big document',
+                                'body': body}
+        d.edit(text_format=None, text=html)
+        assert d.CookedBody() == body
+        
+
     def test_EditStructuredTextWithHTML(self):
         d = Document('foo')
         d.edit(text_format=None, text=STX_WITH_HTML)
@@ -235,6 +255,8 @@
         assert len( d.Subject() ) == 2
         assert 'plain' in d.Subject()
         assert 'STX' in d.Subject()
+
+    
 
 
 class TestDocumentPUT(unittest.TestCase):