[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/ Backported

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Aug 12 12:29:44 EDT 2004


Log message for revision 27059:
  Backported
  
  r26488 | srichter | 2004-07-13 13:13:19 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26489 | srichter | 2004-07-13 13:14:44 -0400 (Tue, 13 Jul 2004) | 3 lines
  r26490 | srichter | 2004-07-13 13:15:34 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26491 | srichter | 2004-07-13 13:16:12 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26492 | srichter | 2004-07-13 13:18:09 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26493 | srichter | 2004-07-13 13:19:25 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26494 | srichter | 2004-07-13 13:21:02 -0400 (Tue, 13 Jul 2004) | 4 lines
  r26495 | srichter | 2004-07-13 13:23:17 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26496 | srichter | 2004-07-13 13:24:35 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26497 | srichter | 2004-07-13 13:25:02 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26498 | srichter | 2004-07-13 13:26:37 -0400 (Tue, 13 Jul 2004) | 5 lines
  r26499 | srichter | 2004-07-13 13:31:56 -0400 (Tue, 13 Jul 2004) | 2 lines
  
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py
  A   Zope3/branches/ZopeX3-3.0/src/zope/app/dtmlpage/ftests.py
  A   Zope3/branches/ZopeX3-3.0/src/zope/app/file/browser/ftests.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.pt
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/rotterdam/editingwidgets.py
  A   Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/browser/ftests.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/principalrole.py
  A   Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/ftests/test_tasks.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tasks.pt
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tools.py
  A   Zope3/branches/ZopeX3-3.0/src/zope/app/sqlscript/browser/ftests.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/configure.zcml
  A   Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/ftests.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -33,7 +33,7 @@
     def testReload(self):
         response = self.publish('/++etc++process/@@TranslationDomain.html',
                                 basic='mgr:mgrpw',
-                                form={'language': u'en',
+                                form={'language': u'de',
                                       'domain': u'zope',
                                       'RELOAD': u'Reload'})
         body = response.getBody()

Added: Zope3/branches/ZopeX3-3.0/src/zope/app/dtmlpage/ftests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/dtmlpage/ftests.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/dtmlpage/ftests.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -0,0 +1,120 @@
+##############################################################################
+#
+# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Functional tests for DTML Page.
+
+$Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
+"""
+import unittest
+from zope.app.tests.functional import BrowserTestCase
+from zope.app.dtmlpage.dtmlpage import DTMLPage
+from xml.sax.saxutils import escape
+
+class DTMLPageTest(BrowserTestCase):
+
+    content = u'<html><body><dtml-var "REQUEST.URL[1]"></body></html>' 
+
+    def addDTMLPage(self):
+        dtmlpage = DTMLPage(self.content)
+        root = self.getRootFolder()
+        root['dtmlpage'] = dtmlpage
+        self.commit()
+
+    def testAddForm(self):
+        response = self.publish(
+            '/+/zope.app.dtmlpage.DTMLPage=',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Add a DTML Page' in body)
+        self.assert_('Source' in body)
+        self.assert_('Object Name' in body)
+        self.assert_('"Add"' in body)
+        self.checkForBrokenLinks(body, '/+/zope.app.dtmlpage.DTMLPage=',
+                                 'mgr:mgrpw')
+
+    def testAdd(self):
+        response = self.publish(
+            '/+/zope.app.dtmlpage.DTMLPage=',
+            form={'type_name': u'zope.app.dtmlpage.DTMLPage',
+                  'field.source': u'<h1>A DTML Page</h1>',
+                  'add_input_name': u'dtmlpage',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 302)
+        self.assertEqual(response.getHeader('Location'),
+                         'http://localhost/@@contents.html')
+        root = self.getRootFolder()
+        self.assert_('dtmlpage' in root)
+        dtmlpage = root['dtmlpage']
+        self.assertEqual(dtmlpage.source, '<h1>A DTML Page</h1>')
+
+    def testEditForm(self):
+        self.addDTMLPage()
+        response = self.publish(
+            '/dtmlpage/@@edit.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Edit a DTML page' in body)
+        self.assert_('Source' in body)
+        self.assert_(escape(self.content) in body)
+        self.checkForBrokenLinks(body, '/dtmlpage/@@edit.html', 'mgr:mgrpw')
+
+    def testEdit(self):
+        self.addDTMLPage()
+        response = self.publish(
+            '/dtmlpage/@@edit.html',
+            form={'field.source': u'<h1>A DTML Page</h1>',
+                  'UPDATE_SUBMIT': u'Edit'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Edit a DTML page' in body)
+        self.assert_('Source' in body)
+        self.assert_(escape(u'<h1>A DTML Page</h1>') in body)
+        root = self.getRootFolder()
+        dtmlpage = root['dtmlpage']
+        self.assertEqual(dtmlpage.source, '<h1>A DTML Page</h1>')
+        
+    def testIndex(self):
+        self.addDTMLPage()
+        response = self.publish(
+            '/dtmlpage/@@index.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assertEqual(
+            body,
+            '<html><body>http://localhost/dtmlpage</body></html>')
+        self.checkForBrokenLinks(body, '/dtmlpage/@@index.html', 'mgr:mgrpw')
+
+    def testPreview(self):
+        self.addDTMLPage()
+        response = self.publish(
+            '/dtmlpage/@@preview.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_(
+            '<iframe src="." height="98%" width="98%"></iframe>' in body)
+        self.checkForBrokenLinks(body, '/dtmlpage/@@preview.html', 'mgr:mgrpw')
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(DTMLPageTest),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Added: Zope3/branches/ZopeX3-3.0/src/zope/app/file/browser/ftests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/file/browser/ftests.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/file/browser/ftests.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -0,0 +1,253 @@
+##############################################################################
+#
+# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Functional tests for File and Image.
+
+$Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
+"""
+import unittest
+from xml.sax.saxutils import escape
+from StringIO import StringIO
+
+from zope.app.tests.functional import BrowserTestCase
+from zope.app.file.file import File
+from zope.app.file.image import Image
+from zope.app.file.tests.test_image import zptlogo
+
+class FileTest(BrowserTestCase):
+
+    content = u'File <Data>' 
+
+    def addFile(self):
+        file = File(self.content)
+        root = self.getRootFolder()
+        root['file'] = file
+        self.commit()
+
+    def testAddForm(self):
+        response = self.publish(
+            '/+/zope.app.file.File=',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Add a File' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.assert_('Object Name' in body)
+        self.assert_('"Add"' in body)
+        self.checkForBrokenLinks(body, '/+/zope.app.file.File=',
+                                 'mgr:mgrpw')
+
+    def testAdd(self):
+        response = self.publish(
+            '/+/zope.app.file.File=',
+            form={'type_name': u'zope.app.file.File',
+                  'field.data': StringIO('A file'),
+                  'add_input_name': u'file',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 302)
+        self.assertEqual(response.getHeader('Location'),
+                         'http://localhost/@@contents.html')
+        root = self.getRootFolder()
+        self.assert_('file' in root)
+        file = root['file']
+        self.assertEqual(file.data, 'A file')
+
+    def testEditForm(self):
+        self.addFile()
+        response = self.publish(
+            '/file/@@edit.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Change a file' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.assert_(escape(self.content) in body)
+        self.checkForBrokenLinks(body, '/file/@@edit.html', 'mgr:mgrpw')
+
+    def testEdit(self):
+        self.addFile()
+        response = self.publish(
+            '/file/@@edit.html',
+            form={'field.data': u'<h1>A File</h1>',
+                  'field.contentType': u'text/plain',
+                  'UPDATE_SUBMIT': u'Edit'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Change a file' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.assert_(escape(u'<h1>A File</h1>') in body)
+        root = self.getRootFolder()
+        file = root['file']
+        self.assertEqual(file.data, '<h1>A File</h1>')
+        self.assertEqual(file.contentType, 'text/plain')
+
+    def testUploadForm(self):
+        self.addFile()
+        response = self.publish(
+            '/file/@@upload.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Upload a file' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.failIf(escape(self.content) in body)
+        self.checkForBrokenLinks(body, '/file/@@upload.html', 'mgr:mgrpw')
+
+    def testUpload(self):
+        self.addFile()
+        response = self.publish(
+            '/file/@@upload.html',
+            form={'field.data': StringIO('<h1>A file</h1>'),
+                  'field.contentType': u'text/plain',
+                  'UPDATE_SUBMIT': u'Change'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Upload a file' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.failIf(escape(u'<h1>A File</h1>') in body)
+        root = self.getRootFolder()
+        file = root['file']
+        self.assertEqual(file.data, '<h1>A file</h1>')
+        self.assertEqual(file.contentType, 'text/plain')
+        
+    def testIndex(self):
+        self.addFile()
+        response = self.publish(
+            '/file/@@index.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assertEqual(body, self.content)
+        self.checkForBrokenLinks(body, '/file/@@index.html', 'mgr:mgrpw')
+
+    def testPreview(self):
+        self.addFile()
+        response = self.publish(
+            '/file/@@preview.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_(
+            '<iframe src="." height="98%" width="98%"></iframe>' in body)
+        self.checkForBrokenLinks(body, '/file/@@preview.html', 'mgr:mgrpw')
+
+
+class ImageTest(BrowserTestCase):
+
+    content = zptlogo
+
+    def addImage(self):
+        image = Image(self.content)
+        root = self.getRootFolder()
+        root['image'] = image
+        self.commit()
+
+    def testAddForm(self):
+        response = self.publish(
+            '/+/zope.app.file.Image=',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Add a Image' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.assert_('Object Name' in body)
+        self.assert_('"Add"' in body)
+        self.checkForBrokenLinks(body, '/+/zope.app.file.Image=',
+                                 'mgr:mgrpw')
+
+    def testAdd(self):
+        response = self.publish(
+            '/+/zope.app.file.Image=',
+            form={'type_name': u'zope.app.image.Image',
+                  'field.data': StringIO(self.content),
+                  'add_input_name': u'image',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 302)
+        self.assertEqual(response.getHeader('Location'),
+                         'http://localhost/@@contents.html')
+        root = self.getRootFolder()
+        self.assert_('image' in root)
+        image = root['image']
+        self.assertEqual(image.data, self.content)
+
+    def testUploadForm(self):
+        self.addImage()
+        response = self.publish(
+            '/image/@@upload.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Upload an image' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.assert_('1 KB 16x16' in body)
+        self.checkForBrokenLinks(body, '/image/@@upload.html', 'mgr:mgrpw')
+
+    def testUpload(self):
+        self.addImage()
+        response = self.publish(
+            '/image/@@upload.html',
+            form={'field.data': StringIO(''),
+                  'UPDATE_SUBMIT': u'Change'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Upload an image' in body)
+        self.assert_('Content Type' in body)
+        self.assert_('Data' in body)
+        self.assert_('0 KB ?x?' in body)
+        root = self.getRootFolder()
+        image = root['image']
+        self.assertEqual(image.data, '')
+        self.assertEqual(image.contentType, 'image/gif')
+        
+    def testIndex(self):
+        self.addImage()
+        response = self.publish(
+            '/image/@@index.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assertEqual(body, self.content)
+        self.checkForBrokenLinks(body, '/image/@@index.html', 'mgr:mgrpw')
+
+    def testPreview(self):
+        self.addImage()
+        response = self.publish(
+            '/image/@@preview.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_(
+            '<iframe src="." height="98%" width="98%"></iframe>' in body)
+        self.checkForBrokenLinks(body, '/image/@@preview.html', 'mgr:mgrpw')
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(FileTest),
+        unittest.makeSuite(ImageTest),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/form/browser/textwidgets.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -15,6 +15,7 @@
 
 $Id$
 """
+from xml.sax import saxutils
 from zope.interface import implements
 
 from zope.app.form.interfaces import IInputWidget, ConversionError
@@ -24,6 +25,17 @@
 from zope.app.datetimeutils import DateTimeError
 
 
+def escape(str):
+    if str is not None:
+        str = saxutils.escape(str)
+    return str
+
+def unescape(str):
+    if str is not None:
+        str = saxutils.unescape(str)
+    return str
+
+
 class TextWidget(SimpleInputWidget):
     """Text widget.
 
@@ -141,7 +153,7 @@
                 value = unicode(input)
             except ValueError, v:
                 raise ConversionError("Invalid text data", v)
-        return decode_html(value)
+        return unescape(value)
 
 
 class Bytes(SimpleInputWidget):
@@ -262,7 +274,7 @@
             except ValueError, v:
                 raise ConversionError("Invalid unicode data", v)
             else:
-                value = decode_html(value)
+                value = unescape(value)
                 value = value.replace("\r\n", "\n")                
         return value
 
@@ -270,7 +282,7 @@
         value = super(TextAreaWidget, self)._toFormValue(value)
         if value:
             value = value.replace("\n", "\r\n")
-            value = encode_html(value)
+            value = escape(value)
         return value
 
     def __call__(self):
@@ -430,21 +442,3 @@
                 return parseDatetimetz(input).date()
             except (DateTimeError, ValueError, IndexError), v:
                 raise ConversionError("Invalid datetime data", v)
-
-
-def encode_html(text):
-    if text:
-        text = text.replace('&', '&amp;')
-        text = text.replace('<', '&lt;')
-        text = text.replace('>', '&gt;')
-        text = text.replace('"', '&quot;')
-    return text
-
-
-def decode_html(text):
-    if text:
-        text = text.replace('&amp;', '&')
-        text = text.replace('&lt;', '<')
-        text = text.replace('&gt;', '>')
-        text = text.replace('&quot;', '"')
-    return text

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.pt
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.pt	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.pt	2004-08-12 16:29:43 UTC (rev 27059)
@@ -88,7 +88,7 @@
         <th width="15%" i18n:translate="">Language</th>
         <th width="20%" i18n:translate="">Status</th>
       </tr>
-      <tal:block repeat="message python: view.queryMessages().items()">
+      <tal:block repeat="message python: view.queryMessageItems()">
         <tr tal:define="number repeat/message/number;
                         oddrow repeat/message/odd"
             tal:attributes="class python: oddrow and 'odd' or 'even'">

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/i18n/browser/synchronize.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -20,6 +20,8 @@
 import xmlrpclib
 from base64 import encodestring
 
+from zope.security.proxy import trustedRemoveSecurityProxy
+
 from zope.app.i18n.browser import BaseView
 from zope.app.i18n import ZopeMessageIDFactory as _
 
@@ -118,6 +120,11 @@
         return self.context.getMessagesMapping(self.sync_languages,
                                                fmsgs)
 
+    def queryMessageItems(self):
+        items = self.queryMessages().items()
+        items = trustedRemoveSecurityProxy(items)
+        items.sort(lambda x, y: cmp(x[0][0] + x[0][1], y[0][0]+y[0][1]))
+        return items
 
     def getStatus(self, fmsg, lmsg, verbose=1):
         state = 0

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/rotterdam/editingwidgets.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/rotterdam/editingwidgets.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/rotterdam/editingwidgets.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -18,10 +18,11 @@
 
 from zope.interface import implements
 from zope.app.form.interfaces import IInputWidget
-from zope.app.form.browser.widget import SimpleInputWidget, renderElement
+from zope.app.form.browser import TextAreaWidget
+from zope.app.form.browser.widget import renderElement
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 
-class SimpleEditingWidget(SimpleInputWidget):
+class SimpleEditingWidget(TextAreaWidget):
     """Improved textarea editing, with async saving using JavaScript."""
 
     implements(IInputWidget)

Added: Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/browser/ftests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/browser/ftests.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/browser/ftests.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -0,0 +1,153 @@
+##############################################################################
+#
+# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Functional tests for Security Policy's Grant screens.
+
+$Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
+"""
+import unittest
+from zope.app.tests.functional import BrowserTestCase
+
+class GrantTest(BrowserTestCase):
+
+    def testGrant(self):
+        response = self.publish(
+            '/@@grant.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Grant permissions to roles' in body)
+        self.assert_('Grant roles to principals' in body)
+        self.checkForBrokenLinks(body, '/@@grant.html', 'mgr:mgrpw')
+
+
+class RolePermissionsTest(BrowserTestCase):
+
+    def testAllRolePermissionsForm(self):
+        response = self.publish(
+            '/@@AllRolePermissions.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Permissions' in body)
+        self.assert_('Manage Content' in body)
+        self.assert_('Manage Services' in body)
+        self.assert_('Roles' in body)
+        self.assert_('Site Manager' in body)
+        self.assert_('Site Member' in body)
+        self.failIf(_result in body)
+        self.checkForBrokenLinks(body, '/@@AllRolePermissions.html',
+                                 'mgr:mgrpw')
+
+    def testAllRolePermissions(self):
+        response = self.publish(
+            '/@@AllRolePermissions.html',
+            form={'p0r0': 'Allow',
+                  'p0': 'zope.ManageContent',
+                  'r0': 'zope.Manager',
+                  'SUBMIT': 'Save Changes'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('<p>Settings changed' in body)
+        self.assert_(_result in body)
+
+    def testRolesWithPermissionsForm(self):
+        response = self.publish(
+            '/@@RolesWithPermissions.html?permission_to_manage=zope.View',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Roles assigned to the permission' in body)
+        self.assert_('Role' in body)
+        self.assert_('Setting' in body)
+        self.assert_('"Save Changes"' in body)
+        self.checkForBrokenLinks(body, '/@@RolesWithPermissions.html',
+                                 'mgr:mgrpw')
+
+    def testRolesWithPermissionsForm(self):
+        response = self.publish(
+            '/@@RolePermissions.html?role_to_manage=zope.Manager',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Permissions assigned to the role' in body)
+        self.assert_('Allow' in body)
+        self.assert_('Deny' in body)
+        self.checkForBrokenLinks(body, '/@@RolesPermissions.html',
+                                 'mgr:mgrpw')
+
+_result = '''\
+            <option value="Unset"> </option>
+            <option value="Allow" selected="selected">+</option>
+            <option value="Deny">-</option>
+'''
+
+class PrincipalRolesTest(BrowserTestCase):
+
+    def testPrincipalRolesForm(self):
+        response = self.publish(
+            '/@@PrincipalRoles.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Apply filter' in body)
+        self.assert_('Principal(s)' in body)
+        self.assert_('Role(s)' in body)
+        self.assert_('"Filter"' in body)
+        self.checkForBrokenLinks(body, '/@@PrincipalRoles.html',
+                                 'mgr:mgrpw')
+
+    def testPrincipalRoles(self):
+        response = self.publish(
+            '/@@PrincipalRoles.html',
+            form={'principals': ['zope.mgr'],
+                  'roles': ['zope.Member', 'zope.Manager'],
+                  'Filter': 'Filter'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('zope.mgr' in body)
+        self.assert_('zope.Member' in body)
+        self.assert_('"APPLY"' in body)
+        self.failIf(_result in body)
+        self.checkForBrokenLinks(body, '/@@PrincipalRoles.html',
+                                 'mgr:mgrpw')
+
+    def testPrincipalRolesApply(self):
+        response = self.publish(
+            '/@@PrincipalRoles.html',
+            form={'principals': ['zope.mgr'],
+                  'roles': ['zope.Member', 'zope.Manager'],
+                  'grid.zope.Member.zope.mgr': 'Allow', 
+                  'APPLY': 'Apply'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Apply filter' in body)
+        self.assert_('Principal(s)' in body)
+        self.assert_('Role(s)' in body)
+        self.assert_('"Filter"' in body)
+        self.checkForBrokenLinks(body, '/@@PrincipalRoles.html',
+                                 'mgr:mgrpw')
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(GrantTest),
+        unittest.makeSuite(RolePermissionsTest),
+        unittest.makeSuite(PrincipalRolesTest),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/principalrole.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/principalrole.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/principalrole.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -11,8 +11,11 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Mappings between principals and roles, stored in an object locally."""
+"""Mappings between principals and roles, stored in an object locally.
 
+$Id$
+"""
+
 __metaclass__ = type
 
 from zope.interface import implements

Added: Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/ftests/test_tasks.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/ftests/test_tasks.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/ftests/test_tasks.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Site Tasks functional tests
+
+$Id: test_services.py 25177 2004-06-02 13:17:31Z jim $
+"""
+import unittest
+
+from zope.app.tests.functional import BrowserTestCase
+
+
+class TasksTest(BrowserTestCase):
+
+    def testTasks(self):
+        path = '/++etc++site/@@tasks.html'
+        response = self.publish(path, basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+
+        body = response.getBody()
+        self.assert_('Common Site Management' in body)
+        self.checkForBrokenLinks(body, path, basic='mgr:mgrpw')
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TasksTest))
+    return suite
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tasks.pt
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tasks.pt	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tasks.pt	2004-08-12 16:29:43 UTC (rev 27059)
@@ -27,29 +27,22 @@
 
       <ul>
         <li>
+          <a href="@@tools.html" i18n:translate="label-configure-services">
+            Tools Management
+          </a>
+        </li>
+        <li>
           <a href="@@services.html" i18n:translate="label-configure-services">
-            Configure services
+            Services Overview
           </a>
         </li>
 
         <li>
           <a href="default/Utilities/@@utilities.html"
              i18n:translate="label-configure-utilities">
-            Configure utilities
+            Utilities Overview (<b>default</b> Site Manager)
           </a>
         </li>
-
-        <li>
-          <a href="default/AddService" i18n:translate="label-add-service">
-            Add a service
-          </a>
-        </li>
-
-        <li>
-          <a href="default/AddUtility" i18n:translate="label-add-utility">
-            Add a utility
-          </a>
-        </li>
       </ul>
     </dd>
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tools.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tools.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/site/browser/tools.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -65,6 +65,7 @@
             tools.append({'title':view.title,
                           'description':view.description,
                           'action':'./@@manage%sTool.html' % name })
+        tools.sort(lambda x, y: cmp(x['title'], y['title']))
         return tools
 
 class ToolsBacklink:

Added: Zope3/branches/ZopeX3-3.0/src/zope/app/sqlscript/browser/ftests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/sqlscript/browser/ftests.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/sqlscript/browser/ftests.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -0,0 +1,144 @@
+##############################################################################
+#
+# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Functional tests for SQL Script.
+
+$Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
+"""
+import unittest
+from zope.app.tests.functional import BrowserTestCase
+from zope.app.sqlscript.sqlscript import SQLScript
+from xml.sax.saxutils import escape
+
+class SQLScriptTest(BrowserTestCase):
+
+    content = u'SELECT * FROM foo' 
+
+    def addSQLScript(self):
+        sqlscript = SQLScript()
+        sqlscript.source = self.content
+        root = self.getRootFolder()
+        root['sqlscript'] = sqlscript
+        self.commit()
+
+
+    def testAddForm(self):
+        response = self.publish(
+            '/+/zope.app.sqlscript.SQLScript=',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Add a SQL Script' in body)
+        self.assert_('Connection Name' in body)
+        self.assert_('(no value)' in body)
+        self.assert_('Arguments' in body)
+        self.assert_('Source' in body)
+        self.assert_('Object Name' in body)
+        self.assert_('"Add"' in body)
+        self.assert_('"Add and Test"' in body)
+        self.checkForBrokenLinks(body, '/+/zope.app.sqlscript.SQLScript=',
+                                 'mgr:mgrpw')
+
+
+    def testAdd(self):
+        response = self.publish(
+            '/+/zope.app.sqlscript.SQLScript=',
+            form={'type_name': u'zope.app.sqlscript.SQLScript',
+                  'field.source': u'SELECT * FROM foo',
+                  'field.connectionName.used': u'',
+                  'field.connectionName': u'',
+                  'add_input_name': u'sqlscript',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 302)
+        self.assertEqual(response.getHeader('Location'),
+                         'http://localhost/@@contents.html')
+        root = self.getRootFolder()
+        self.assert_('sqlscript' in root)
+        sqlscript = root['sqlscript']
+        self.assertEqual(sqlscript.source, self.content)
+        self.assertEqual(sqlscript.arguments, '')
+        self.assertEqual(sqlscript.connectionName, None)
+
+        response = self.publish(
+            '/+/zope.app.sqlscript.SQLScript=',
+            form={'type_name': u'zope.app.sqlscript.SQLScript',
+                  'field.source': u'SELECT * FROM foo',
+                  'field.arguments': u'table',
+                  'field.connectionName.used': u'',
+                  'field.connectionName': u'',
+                  'add_input_name': u'sqlscript1',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        root = self.getRootFolder()
+        sqlscript = root['sqlscript1']
+        self.assertEqual(sqlscript.source, 'SELECT * FROM foo')
+        self.assertEqual(sqlscript.arguments, 'table')
+        self.assertEqual(sqlscript.connectionName, None)
+
+
+    def testEditForm(self):
+        self.addSQLScript()
+        response = self.publish(
+            '/sqlscript/@@edit.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Connection Name' in body)
+        self.assert_('(no value)' in body)
+        self.assert_('Arguments' in body)
+        self.assert_('Source' in body)
+        self.assert_('Connection Name' in body)
+        self.assert_('"Change"' in body)
+        self.assert_('"Change and Test"' in body)
+        self.assert_(escape(self.content) in body)
+        self.checkForBrokenLinks(body, '/sqlscript/@@edit.html', 'mgr:mgrpw')
+
+
+    def testEdit(self):
+        self.addSQLScript()
+        response = self.publish(
+            '/sqlscript/@@edit.html',
+            form={'field.source': u'SELECT * FROM bar',
+                  'field.connectionName.used': u'',
+                  'field.connectionName': u'',                  
+                  'UPDATE_SUBMIT': u'Change'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Edit an SQL script' in body)
+        self.assert_(escape(u'SELECT * FROM bar') in body)
+        root = self.getRootFolder()
+        sqlscript = root['sqlscript']
+        self.assertEqual(sqlscript.source, 'SELECT * FROM bar')
+        
+    def testTestForm(self):
+        self.addSQLScript()
+        response = self.publish(
+            '/sqlscript/@@test.html',
+            basic='mgr:mgrpw')
+        body = response.getBody()
+        self.assert_('"Test"' in body)
+        self.assert_(escape(self.content) in body)
+        self.assertEqual(response.getStatus(), 200)
+        self.checkForBrokenLinks(body, '/sqlscript/@@test.html', 'mgr:mgrpw')
+
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(SQLScriptTest),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/configure.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/configure.zcml	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/configure.zcml	2004-08-12 16:29:43 UTC (rev 27059)
@@ -1,7 +1,7 @@
 <configure
-    xmlns='http://namespaces.zope.org/zope'
-    xmlns:browser='http://namespaces.zope.org/browser'
-    i18n_domain='zope'
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    i18n_domain="zope"
     >
 
   <browser:page

Added: Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/ftests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/ftests.py	2004-08-12 16:19:30 UTC (rev 27058)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/zptpage/browser/ftests.py	2004-08-12 16:29:43 UTC (rev 27059)
@@ -0,0 +1,183 @@
+##############################################################################
+#
+# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Functional tests for ZPT Page.
+
+$Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
+"""
+import unittest
+from zope.app.tests.functional import BrowserTestCase
+from zope.app.zptpage.zptpage import ZPTPage
+from xml.sax.saxutils import escape
+
+class ZPTPageTest(BrowserTestCase):
+
+    content = u'<html><body><h1 tal:content="request/URL/1" /></body></html>' 
+
+    def addZPTPage(self):
+        zptpage = ZPTPage()
+        zptpage.source = self.content
+        root = self.getRootFolder()
+        root['zptpage'] = zptpage
+        self.commit()
+
+
+    def testAddForm(self):
+        response = self.publish(
+            '/+/zope.app.zptpage.ZPTPage=',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Add a ZPT Page' in body)
+        self.assert_('Source' in body)
+        self.assert_('Expand macros' in body)
+        self.assert_('Evaluate Inline Code' in body)
+        self.assert_('Object Name' in body)
+        self.assert_('"Add"' in body)
+        self.checkForBrokenLinks(body, '/+/zope.app.zptpage.ZPTPage=',
+                                 'mgr:mgrpw')
+
+
+    def testAdd(self):
+        response = self.publish(
+            '/+/zope.app.zptpage.ZPTPage=',
+            form={'type_name': u'zope.app.zptpage.ZPTPage',
+                  'field.source': u'<h1>A ZPT Page</h1>',
+                  'field.expand.used': u'',
+                  'field.evaluateInlineCode.used': u'',
+                  'add_input_name': u'zptpage',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 302)
+        self.assertEqual(response.getHeader('Location'),
+                         'http://localhost/@@contents.html')
+        root = self.getRootFolder()
+        self.assert_('zptpage' in root)
+        zptpage = root['zptpage']
+        self.assertEqual(zptpage.source, '<h1>A ZPT Page</h1>')
+        self.assertEqual(zptpage.expand, False)
+        self.assertEqual(zptpage.evaluateInlineCode, False)
+
+        response = self.publish(
+            '/+/zope.app.zptpage.ZPTPage=',
+            form={'type_name': u'zope.app.zptpage.ZPTPage',
+                  'field.source': u'<h1>A ZPT Page</h1>\n',
+                  'field.expand.used': u'',
+                  'field.expand': u'on',
+                  'field.evaluateInlineCode.used': u'',
+                  'field.evaluateInlineCode': u'on',
+                  'add_input_name': u'zptpage1',
+                  'UPDATE_SUBMIT': u'Add'},
+            basic='mgr:mgrpw')
+        root = self.getRootFolder()
+        zptpage = root['zptpage1']
+        self.assertEqual(zptpage.source, '<h1>A ZPT Page</h1>\n')
+        self.assertEqual(zptpage.expand, True)
+        self.assertEqual(zptpage.evaluateInlineCode, True)
+
+
+    def testEditForm(self):
+        self.addZPTPage()
+        response = self.publish(
+            '/zptpage/@@edit.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Edit a ZPT page' in body)
+        self.assert_('Source' in body)
+        self.assert_('Expand macros' in body)
+        self.assert_(escape(self.content) in body)
+        self.checkForBrokenLinks(body, '/zptpage/@@edit.html', 'mgr:mgrpw')
+
+
+    def testEdit(self):
+        self.addZPTPage()
+        response = self.publish(
+            '/zptpage/@@edit.html',
+            form={'field.source': u'<h1>A ZPT Page</h1>\n',
+                  'field.expand.used': u'',
+                  'field.expand': u'on',                  
+                  'UPDATE_SUBMIT': u'Edit'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Edit a ZPT page' in body)
+        self.assert_('Source' in body)
+        self.assert_(escape(u'<h1>A ZPT Page</h1>') in body)
+        root = self.getRootFolder()
+        zptpage = root['zptpage']
+        self.assertEqual(zptpage.source, '<h1>A ZPT Page</h1>\n')
+        self.assertEqual(zptpage.expand, True)
+        
+    def testIndex(self):
+        self.addZPTPage()
+        response = self.publish(
+            '/zptpage/@@index.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assertEqual(
+            body,
+            '<html><body><h1>http://localhost/zptpage</h1></body></html>\n')
+        self.checkForBrokenLinks(body, '/zptpage/@@index.html', 'mgr:mgrpw')
+
+    def testPreview(self):
+        self.addZPTPage()
+        response = self.publish(
+            '/zptpage/@@preview.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_(
+            '<iframe src="." height="98%" width="98%"></iframe>' in body)
+        self.checkForBrokenLinks(body, '/zptpage/@@preview.html', 'mgr:mgrpw')
+
+    def testSource(self):
+        self.addZPTPage()
+        response = self.publish(
+            '/zptpage/@@source.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assertEqual(body, self.content)
+
+    def testInlineCode(self):
+        self.addZPTPage()
+        response = self.publish(
+            '/zptpage/@@inlineCode.html',
+            form={'field.evaluateInlineCode.used': u'',
+                  'field.evaluateInlineCode': u'on',
+                  'UPDATE_SUBMIT': u'Edit'},
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        body = response.getBody()
+        self.assert_('Inline Code' in body)
+        self.assert_('Evaluate Inline Code' in body)
+        self.checkForBrokenLinks(body, '/zptpage/@@edit.html', 'mgr:mgrpw')
+
+        response = self.publish(
+            '/zptpage/@@inlineCode.html',
+            basic='mgr:mgrpw')
+        self.assertEqual(response.getStatus(), 200)
+        root = self.getRootFolder()
+        zptpage = root['zptpage']
+        self.assertEqual(zptpage.evaluateInlineCode, True)
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(ZPTPageTest),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')



More information about the Zope3-Checkins mailing list