[Zope-Checkins] SVN: Zope/branches/whitmo-2.10-layers/ Merged r69724:70147 from 2.10 branch to pull in recent ZTC changes.

Stefan H. Holek stefan at epy.co.at
Wed Sep 13 09:03:52 EDT 2006


Log message for revision 70149:
  Merged r69724:70147 from 2.10 branch to pull in recent ZTC changes.
  

Changed:
  U   Zope/branches/whitmo-2.10-layers/doc/CHANGES.txt
  U   Zope/branches/whitmo-2.10-layers/doc/FAQ.txt
  U   Zope/branches/whitmo-2.10-layers/lib/python/OFS/Application.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/OFS/Image.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/OFS/ObjectManager.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/imageView.dtml
  U   Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/main.dtml
  A   Zope/branches/whitmo-2.10-layers/lib/python/OFS/tests/testCopySupportHooks.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/OFS/tests/testFileAndImage.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/Mail-Host.stx
  U   Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/MailHost.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/tests/testMailHost.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
  U   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/VERSION.txt
  U   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/runalltests.py
  A   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/tests.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
  A   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
  U   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
  A   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
  UU  Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/ztc_common.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/ZServer/FCGIServer.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/Zope.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/tests/testZope.py
  U   Zope/branches/whitmo-2.10-layers/lib/python/webdav/Resource.py
  A   Zope/branches/whitmo-2.10-layers/lib/python/webdav/tests/testPUT_factory.py
  U   Zope/branches/whitmo-2.10-layers/setup.py
  U   Zope/branches/whitmo-2.10-layers/skel/etc/site.zcml

-=-
Modified: Zope/branches/whitmo-2.10-layers/doc/CHANGES.txt
===================================================================
--- Zope/branches/whitmo-2.10-layers/doc/CHANGES.txt	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/doc/CHANGES.txt	2006-09-13 13:03:50 UTC (rev 70149)
@@ -8,6 +8,24 @@
 
     Bugs fixed
 
+      - Collector #2185: Log username for FCGI requests.
+
+      - Collector #2152: Fixed MailHost documentation; simple_send does not
+        process or validate its arguments in any way.
+
+      - Collector #2175: ZTUtils.make_hidden_input did not escape double-quotes.
+
+      - Collector #2176: Fixed bad logging call.
+
+      - Collector #1907: Moved 'alt' property from File to Image.
+
+      - Collector #1983: Specifying session-resolution-seconds >= 1200 caused
+        Zope startup to fail.
+
+      - Collector #2169: webdav.Resource.COPY did not send ObjectClonedEvent.
+
+      - Collector #2178: Fix ZopeTestCase doctest support for layers
+
   Zope 2.10.0 beta 2 (2006/08/20)
 
     Bugs Fixed
@@ -72,6 +90,8 @@
         
       - The defaultView directive now only looks up views, not attributes.
 
+      - Collector #2178: Fix ZopeTestCase doctest support for layers
+
     Other Changes
 
       - Disabled docutils file inclusion completely, rather than trying

Modified: Zope/branches/whitmo-2.10-layers/doc/FAQ.txt
===================================================================
--- Zope/branches/whitmo-2.10-layers/doc/FAQ.txt	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/doc/FAQ.txt	2006-09-13 13:03:50 UTC (rev 70149)
@@ -249,10 +249,9 @@
 
     4. Plone doesn't work!
 
-        As of the release of Zope 2.8.0, Plone does not support
-        Zope 2.8 yet.  Check http://www.plone.org for updates.
+        All Plone versions require a certain Zope version.
+        Check the Plone release informations on http://www.plone.org
 
-
   General
 
 

Modified: Zope/branches/whitmo-2.10-layers/lib/python/OFS/Application.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/OFS/Application.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/OFS/Application.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -426,14 +426,7 @@
                          'session-delete-notify-script-path' % delnotify)
                 delnotify=None
 
-            toc = TransientObjectContainer(
-                'session_data', 'Session Data Container',
-                addNotification = addnotify,
-                delNotification = delnotify,
-                limit=limit,
-                period_secs=period_spec)
-
-            if timeout_spec is not None:
+            if 1:  # Preserve indentation for diff
                 toc = TransientObjectContainer('session_data',
                                                'Session Data Container',
                                                timeout_mins = timeout_spec,
@@ -678,9 +671,9 @@
 
     for priority, product_name, index, product_dir in products:
         if done.has_key(product_name):
-            LOG.warn('Duplicate Product name',
-                     'After loading Product %s from %s,\n'
-                     'I skipped the one in %s.\n' % (
+            LOG.warn('Duplicate Product name: '
+                     'After loading Product %s from %s, '
+                     'I skipped the one in %s.' % (
                     `product_name`, `done[product_name]`, `product_dir`) )
             continue
         done[product_name]=product_dir

Modified: Zope/branches/whitmo-2.10-layers/lib/python/OFS/Image.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/OFS/Image.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/OFS/Image.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -85,7 +85,6 @@
 
     precondition=''
     size=None
-    alt=''
 
     manage_editForm  =DTMLFile('dtml/fileEdit',globals(),
                                Kind='File',kind='file')
@@ -110,7 +109,6 @@
         )
 
     _properties=({'id':'title', 'type': 'string'},
-                 {'id':'alt', 'type':'string'},
                  {'id':'content_type', 'type':'string'},
                  )
 
@@ -734,6 +732,7 @@
     security = ClassSecurityInfo()
     security.declareObjectProtected(View)
 
+    alt=''
     height=''
     width=''
 
@@ -750,6 +749,7 @@
     security.declareProtected(delete_objects, 'DELETE')
 
     _properties=({'id':'title', 'type': 'string'},
+                 {'id':'alt', 'type':'string'},
                  {'id':'content_type', 'type':'string','mode':'w'},
                  {'id':'height', 'type':'string'},
                  {'id':'width', 'type':'string'},

Modified: Zope/branches/whitmo-2.10-layers/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/OFS/ObjectManager.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/OFS/ObjectManager.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -167,6 +167,8 @@
 
     isPrincipiaFolderish=1
 
+    has_order_support = 0 # See OrderSupport.py
+
     # IPossibleSite API
 
     _components = None

Modified: Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/imageView.dtml
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/imageView.dtml	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/imageView.dtml	2006-09-13 13:03:50 UTC (rev 70149)
@@ -2,10 +2,7 @@
 <dtml-var manage_tabs>
 
 <p>
-<img src="&dtml-absolute_url;" <dtml-if 
- width>width="&dtml-width;" </dtml-if><dtml-if 
- height>height="&dtml-height;" </dtml-if
- > alt="&dtml-title_or_id;" />
+ <dtml-var tag>
 </p>
 
 <dtml-var manage_page_footer>

Modified: Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/main.dtml
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/main.dtml	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/OFS/dtml/main.dtml	2006-09-13 13:03:50 UTC (rev 70149)
@@ -61,7 +61,7 @@
 
 <form action="&dtml-URL1;/" name="objectItems" method="post">
 <dtml-if objectItems>
-  <dtml-let hasOrderSupport="_.hasattr(this().aq_self, 'has_order_support')">
+  <dtml-let hasOrderSupport="_.getattr(this().aq_explicit, 'has_order_support', 0)">
   <dtml-unless skey>
     <dtml-if hasOrderSupport>
       <dtml-call expr="REQUEST.set('skey', getDefaultSorting()[0])">

Copied: Zope/branches/whitmo-2.10-layers/lib/python/OFS/tests/testCopySupportHooks.py (from rev 70147, Zope/branches/2.10/lib/python/OFS/tests/testCopySupportHooks.py)

Modified: Zope/branches/whitmo-2.10-layers/lib/python/OFS/tests/testFileAndImage.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/OFS/tests/testFileAndImage.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/OFS/tests/testFileAndImage.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -277,8 +277,12 @@
           ('<img src="http://foo/file" alt="" title="" height="16" width="16" />'))
 
     def testTag(self):
-        self.assertEqual(self.file.tag(),
-          ('<img src="http://foo/file" alt="" title="" height="16" width="16" />'))
+        tag_fmt = '<img src="http://foo/file" alt="%s" title="%s" height="16" width="16" />'
+        self.assertEqual(self.file.tag(), (tag_fmt % ('','')))
+        self.file.manage_changeProperties(title='foo')
+        self.assertEqual(self.file.tag(), (tag_fmt % ('','foo')))
+        self.file.manage_changeProperties(alt='bar')
+        self.assertEqual(self.file.tag(), (tag_fmt % ('bar','foo')))
 
     def testViewImageOrFile(self):
         pass # dtml method,screw it

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/Mail-Host.stx
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/Mail-Host.stx	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/Mail-Host.stx	2006-09-13 13:03:50 UTC (rev 70149)
@@ -10,7 +10,7 @@
 
       Sends an email message where the messageText is an rfc822 formatted
       message. This allows you complete control over the message headers,
-      including setting any extra headers such as Cc: and Bcc:.
+      including setting any extra headers such as Cc: and Reply-To:.
       The arguments are:
 
         messageText -- The mail message. It can either be a rfc822
@@ -31,9 +31,11 @@
     'simple_send(self, mto, mfrom, subject, body)'
 
       Sends a message. Only To:, From: and Subject: headers can be set.
+      Note that simple_send does not process or validate its arguments
+      in any way.
       The arguments are:
 
-        mto -- A commaseparated string or list of recipient(s) of the message.
+        mto -- A commaseparated string of recipient(s) of the message.
 
         mfrom -- The address of the message sender.
 

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/MailHost.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/MailHost.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/help/MailHost.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -37,7 +37,7 @@
         """
         Sends an email message where the messageText is an rfc822 formatted
         message. This allows you complete control over the message headers,
-        including setting any extra headers such as Cc: and Bcc:.
+        including setting any extra headers such as Cc: and Reply-To:.
         The arguments are:
 
             messageText -- The mail message. It can either be a rfc822
@@ -60,9 +60,11 @@
     def simple_send(self, mto, mfrom, subject, body):
         """
         Sends a message. Only To:, From: and Subject: headers can be set.
+        Note that simple_send does not process or validate its arguments
+        in any way.
         The arguments are:
 
-            mto -- A commaseparated string or list of recipient(s) of the message.
+            mto -- A commaseparated string of recipient(s) of the message.
 
             mfrom -- The address of the message sender.
 

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/tests/testMailHost.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/tests/testMailHost.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Products/MailHost/tests/testMailHost.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -17,15 +17,26 @@
 
 import unittest
 
+from Products.MailHost.MailHost import MailHost
 from Products.MailHost.MailHost import MailHostError, _mungeHeaders
 
 
+class DummyMailHost(MailHost):
+    meta_type = 'Dummy Mail Host'
+    def __init__(self, id):
+        self.id = id
+        self.sent = ''
+    def _send(self, mfrom, mto, messageText):
+        self.sent = messageText
+
+
 class TestMailHost(unittest.TestCase):
 
     def _getTargetClass(self):
-        from Products.MailHost.MailHost import MailHost
+        return DummyMailHost
 
-        return MailHost
+    def _makeOne(self, *args, **kw):
+        return self._getTargetClass()(*args, **kw)
 
     def test_z3interfaces(self):
         from Products.MailHost.interfaces import IMailHost
@@ -113,7 +124,74 @@
                                   '"Foo Bar" <foo at domain.com>'])
         self.failUnless(resfrom == 'sender at domain.com' )
 
+    def testSendMessageOnly(self):
+        msg = """\
+To: "Name, Nick" <recipient at domain.com>, "Foo Bar" <foo at domain.com>
+From: sender at domain.com
+Subject: This is the subject
+Date: Sun, 27 Aug 2006 17:00:00 +0200
 
+This is the message body."""
+
+        mailhost = self._makeOne('MailHost')
+        mailhost.send(msg)
+        self.assertEqual(mailhost.sent, msg)
+
+    def testSendWithArguments(self):
+        inmsg = """\
+Date: Sun, 27 Aug 2006 17:00:00 +0200
+
+This is the message body."""
+
+        outmsg = """\
+Date: Sun, 27 Aug 2006 17:00:00 +0200
+Subject: This is the subject
+To: "Name, Nick" <recipient at domain.com>,"Foo Bar" <foo at domain.com>
+From: sender at domain.com
+
+This is the message body."""
+
+        mailhost = self._makeOne('MailHost')
+        mailhost.send(messageText=inmsg,
+                      mto='"Name, Nick" <recipient at domain.com>, "Foo Bar" <foo at domain.com>',
+                      mfrom='sender at domain.com', subject='This is the subject')
+        self.assertEqual(mailhost.sent, outmsg)
+
+    def testSendWithMtoList(self):
+        inmsg = """\
+Date: Sun, 27 Aug 2006 17:00:00 +0200
+
+This is the message body."""
+
+        outmsg = """\
+Date: Sun, 27 Aug 2006 17:00:00 +0200
+Subject: This is the subject
+To: "Name, Nick" <recipient at domain.com>,"Foo Bar" <foo at domain.com>
+From: sender at domain.com
+
+This is the message body."""
+
+        mailhost = self._makeOne('MailHost')
+        mailhost.send(messageText=inmsg,
+                      mto=['"Name, Nick" <recipient at domain.com>', '"Foo Bar" <foo at domain.com>'],
+                      mfrom='sender at domain.com', subject='This is the subject')
+        self.assertEqual(mailhost.sent, outmsg)
+
+    def testSimpleSend(self):
+        outmsg = """\
+From: sender at domain.com
+To: "Name, Nick" <recipient at domain.com>, "Foo Bar" <foo at domain.com>
+Subject: This is the subject
+
+This is the message body."""
+
+        mailhost = self._makeOne('MailHost')
+        mailhost.simple_send(mto='"Name, Nick" <recipient at domain.com>, "Foo Bar" <foo at domain.com>',
+                             mfrom='sender at domain.com', subject='This is the subject',
+                             body='This is the message body.')
+        self.assertEqual(mailhost.sent, outmsg)
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( TestMailHost ) )

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt	2006-09-13 13:03:50 UTC (rev 70149)
@@ -1,5 +1,5 @@
-Zope 2.10 edition
-- transaction.commit(1) is deprecated in favor of transaction.savepoint().
+0.9.9 (Zope 2.10 edition)
+- transaction.commit(1) is deprecated in favor of transaction.savepoint(1).
 - Don't break if Python distros ship without profile support (Debian, Ubuntu).
 - Functional.publish() would hang if it got a request_method argument other
   than GET or HEAD while omitting the stdin argument.
@@ -7,9 +7,13 @@
   patches.
 - Made functional doctests set cookie related headers.
 - Made functional doctests set the Www-Authenticate header.
-- Made sure logging is configured. Read $INSTANCE_HOME/log.ini if it exists.
+- Made sure logging is configured.
 - Made base.TestCase a new-style class.
 - Added placeless.py for Z3-style setup. Thanks to Whit Morriss.
+- Fixed functional.http() to only pass the request body (no headers) to
+  publish_module(). Thanks to Andreas Zeidler.
+- Fixed doctestsuite factory to copy layers from test_class to the suite.
+  Thanks to Whit Morris.
 
 0.9.8 (Zope 2.8 edition)
 - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/VERSION.txt
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/VERSION.txt	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/doc/VERSION.txt	2006-09-13 13:03:50 UTC (rev 70149)
@@ -1 +1 @@
-ZopeTestCase 0.9.8
+ZopeTestCase 0.9.9

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/runalltests.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/runalltests.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/runalltests.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -27,12 +27,16 @@
 import unittest
 TestRunner = unittest.TextTestRunner
 suite = unittest.TestSuite()
+cwd = os.getcwd()
 
 def test_finder(recurse, dir, names):
     if dir == os.curdir or '__init__.py' in names:
         parts = [x for x in dir[len(os.curdir):].split(os.sep) if x]
         tests = [x for x in names if x.startswith('test') and x.endswith('.py')]
         for test in tests:
+            if test == 'tests.py' and 'ZopeTestCase' in cwd:
+                # Skip tests.py when running ZTC tests
+                continue
             modpath = parts + [test[:-3]]
             m = __import__('.'.join(modpath))
             for part in modpath[1:]:

Copied: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/tests.py (from rev 70147, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/tests.py)

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -132,7 +132,7 @@
     # Discard leading white space to make call layout simpler
     request_string = request_string.lstrip()
 
-    # split off and parse the command line
+    # Split off and parse the command line
     l = request_string.find('\n')
     command_line = request_string[:l].rstrip()
     request_string = request_string[l+1:]
@@ -162,6 +162,10 @@
 
     headers = [split_header(header)
                for header in rfc822.Message(instream).headers]
+
+    # Store request body without headers
+    instream = StringIO(instream.read())
+
     for name, value in headers:
         name = ('_'.join(name.upper().split('-')))
         if name not in ('CONTENT_TYPE', 'CONTENT_LENGTH'):
@@ -200,15 +204,22 @@
     def __init__(self, *args, **kw):
         self._args = args
         self._kw = kw
+        self._layer = None
         self.setup_globs()
         self.setup_test_class()
         self.setup_optionflags()
 
     def doctestsuite(self):
-        return doctest.DocTestSuite(*self._args, **self._kw)
+        suite = doctest.DocTestSuite(*self._args, **self._kw)
+        if self._layer is not None:
+            suite.layer = self._layer
+        return suite
 
     def docfilesuite(self):
-        return doctest.DocFileSuite(*self._args, **self._kw)
+        suite = doctest.DocFileSuite(*self._args, **self._kw)
+        if self._layer is not None:
+            suite.layer = self._layer
+        return suite
 
     def setup_globs(self):
         globs = self._kw.setdefault('globs', {})
@@ -224,6 +235,10 @@
         if 'test_class' in self._kw:
             del self._kw['test_class']
 
+        # Fix for http://zope.org/Collectors/Zope/2178
+        if hasattr(test_class, 'layer'):
+            self._layer = test_class.layer
+
         # If the test_class does not have a runTest method, we add
         # a dummy attribute so that TestCase construction works.
         if not hasattr(test_class, 'runTest'):
@@ -298,6 +313,7 @@
                                        | doctest.REPORT_NDIFF
                                        | doctest.NORMALIZE_WHITESPACE)
 
+
 from Testing.ZopeTestCase.layer import Zope2Layer
 
 def setlayer(layer):
@@ -309,26 +325,27 @@
         return wrapper
     return wrapfactory
 
+
 @setlayer(Zope2Layer)
 def ZopeDocTestSuite(module=None, **kw):
-    module = doctest._normalize_module(module)
+    module = doctest._normalize_module(module, depth=3)
     return ZopeSuiteFactory(module, **kw).doctestsuite()
 
 @setlayer(Zope2Layer)
 def ZopeDocFileSuite(*paths, **kw):
     if kw.get('module_relative', True):
-        kw['package'] = doctest._normalize_module(kw.get('package'))
+        kw['package'] = doctest._normalize_module(kw.get('package'), depth=3)
     return ZopeSuiteFactory(*paths, **kw).docfilesuite()
 
 @setlayer(Zope2Layer)
 def FunctionalDocTestSuite(module=None, **kw):
-    module = doctest._normalize_module(module)
+    module = doctest._normalize_module(module, depth=3)
     return FunctionalSuiteFactory(module, **kw).doctestsuite()
 
 @setlayer(Zope2Layer)
 def FunctionalDocFileSuite(*paths, **kw):
     if kw.get('module_relative', True):
-        kw['package'] = doctest._normalize_module(kw.get('package'))
+        kw['package'] = doctest._normalize_module(kw.get('package'), depth=3)
     return FunctionalSuiteFactory(*paths, **kw).docfilesuite()
 
 

Copied: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt (from rev 70147, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt)

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -27,12 +27,16 @@
 import unittest
 TestRunner = unittest.TextTestRunner
 suite = unittest.TestSuite()
+cwd = os.getcwd()
 
 def test_finder(recurse, dir, names):
     if dir == os.curdir or '__init__.py' in names:
         parts = [x for x in dir[len(os.curdir):].split(os.sep) if x]
         tests = [x for x in names if x.startswith('test') and x.endswith('.py')]
         for test in tests:
+            if test == 'tests.py' and 'ZopeTestCase' in cwd:
+                # Skip tests.py when running ZTC tests
+                continue
             modpath = parts + [test[:-3]]
             m = __import__('.'.join(modpath))
             for part in modpath[1:]:

Copied: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py (from rev 70147, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py)

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -1,15 +1,36 @@
-import os, sys
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Test runner that works with zope.testing.testrunner
+
+$Id$
+"""
+
 import unittest
+import os
+import Testing.ZopeTestCase.zopedoctest
+
 suite = unittest.TestSuite()
 
+names = os.listdir(os.path.dirname(__file__))
+tests = [x[:-3] for x in names
+         if x.startswith('test') and x.endswith('.py')
+         and x != 'tests.py']
+
+for test in tests:
+    m = __import__('Testing.ZopeTestCase.zopedoctest.%s' % test)
+    m = getattr(Testing.ZopeTestCase.zopedoctest, test)
+    if hasattr(m, 'test_suite'):
+        suite.addTest(m.test_suite())
+
 def test_suite():
-    names = os.listdir(os.path.dirname(__file__))
-    tests = [x for x in names \
-             if x.startswith('test') and x.endswith('.py') and not x == 'tests.py']
-
-    for test in tests:
-        Testing = __import__("Testing.ZopeTestCase.zopedoctest." + test[:-3])
-        testmodule = getattr(Testing.ZopeTestCase.zopedoctest, test[:-3])
-        if hasattr(testmodule, 'test_suite'):
-            suite.addTest(testmodule.test_suite())
     return suite


Property changes on: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/ztc_common.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/ztc_common.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/Testing/ZopeTestCase/ztc_common.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -62,13 +62,11 @@
             return
         if self.zeo_instance_home:
             self.setup_zeo_instance_home()
-            self.setup_logging()
         else:
             if self.instance_home:
                 self.setup_instance_home()
             else:
                 self.detect_and_setup_instance_home()
-            self.setup_logging()
             self.setup_custom_zodb()
     
     def setup_zeo_instance_home(self):
@@ -130,13 +128,6 @@
                 os.environ['INSTANCE_HOME'] = INSTANCE_HOME = self.cwd
                 self.setconfig(instancehome=self.cwd)
 
-    def setup_logging(self):
-        '''If $INSTANCE_HOME/log.ini exists, load it.'''
-        logini = os.path.join(self.getconfig('instancehome'), 'log.ini')
-        if os.path.exists(logini):
-            import logging.config
-            logging.config.fileConfig(logini)
-
     def add_instance(self, p):
         '''Adds an INSTANCE_HOME directory to Products.__path__ and sys.path.'''
         import Products

Modified: Zope/branches/whitmo-2.10-layers/lib/python/ZServer/FCGIServer.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/ZServer/FCGIServer.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/ZServer/FCGIServer.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -47,6 +47,7 @@
 import socket, string, os, sys, time
 import thread
 from types import StringTypes
+import base64
 
 tz_for_log = compute_timezone_for_log()
 
@@ -455,11 +456,24 @@
             method=self.env['REQUEST_METHOD']
         else:
             method="GET"
+        if self.env.has_key('HTTP_AUTHORIZATION'):
+            http_authorization=self.env['HTTP_AUTHORIZATION']
+            if string.lower(http_authorization[:6]) == 'basic ':
+                try: decoded=base64.decodestring(http_authorization[6:])
+                except base64.binascii.Error: decoded=''
+                t = string.split(decoded, ':', 1)
+                if len(t) < 2:
+                    user_name = '-'
+                else:
+                    user_name = t[0]
+        else:
+            user_name='-'
         if self.addr:
             self.server.logger.log (
                 self.addr[0],
-                '%s - - [%s] "%s %s" %d %d "%s" "%s"' % (
+                '%s - %s [%s] "%s %s" %d %d "%s" "%s"' % (
                     self.addr[1],
+                    user_name,
                     time.strftime (
                     '%d/%b/%Y:%H:%M:%S ',
                     time.localtime(time.time())
@@ -471,7 +485,8 @@
         else:
             self.server.logger.log (
                 '127.0.0.1 ',
-                '- - [%s] "%s %s" %d %d "%s" "%s"' % (
+                '- %s [%s] "%s %s" %d %d "%s" "%s"' % (
+                    user_name,
                     time.strftime (
                     '%d/%b/%Y:%H:%M:%S ',
                     time.localtime(time.time())

Modified: Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/Zope.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/Zope.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/Zope.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -200,7 +200,7 @@
         d.update(arg)
     d.update(kwargs)
 
-    hq = cgi.escape
+    hq = lambda x:cgi.escape(x, quote=True)
     qlist = complex_marshal(d.items())
     for i in range(len(qlist)):
         k, m, v = qlist[i]

Modified: Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/tests/testZope.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/tests/testZope.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/ZTUtils/tests/testZope.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -5,6 +5,7 @@
 import string
 import urllib
 from ZTUtils.Zope import make_query, complex_marshal
+from ZTUtils.Zope import make_hidden_input
 from DateTime import DateTime
 
 class QueryTests(TestCase):
@@ -50,6 +51,18 @@
                            record=record, string=str_)
         assert query == 'date:date=%s&integer:int=1&listing:int:list=1&listing:date:list=%s&listing:list=str&string=str&record.arg1:int:list:record=1&record.arg1:date:list:record=%s&record.arg1:list:record=str&record.arg2:int:record=1'%(quote_date,quote_date,quote_date)
 
+    def testMakeHiddenInput(self):
+        tag = make_hidden_input(foo='bar')
+        self.assertEqual(tag, '<input type="hidden" name="foo" value="bar">')
+        tag = make_hidden_input(foo=1)
+        self.assertEqual(tag, '<input type="hidden" name="foo:int" value="1">')
+        # Escaping
+        tag = make_hidden_input(foo='bar & baz')
+        self.assertEqual(tag, '<input type="hidden" name="foo" value="bar &amp; baz">')
+        tag = make_hidden_input(foo='<bar>')
+        self.assertEqual(tag, '<input type="hidden" name="foo" value="&lt;bar&gt;">')
+        tag = make_hidden_input(foo='"bar"')
+        self.assertEqual(tag, '<input type="hidden" name="foo" value="&quot;bar&quot;">')
 
 def test_suite():
     return makeSuite(QueryTests)

Modified: Zope/branches/whitmo-2.10-layers/lib/python/webdav/Resource.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/lib/python/webdav/Resource.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/lib/python/webdav/Resource.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -45,7 +45,11 @@
 from interfaces import IWriteLock
 from WriteLockInterface import WriteLockInterface
 
+from zope.event import notify
+from OFS.event import ObjectClonedEvent
+import OFS.subscribers
 
+
 class Resource(ExtensionClass.Base, Lockable.LockableItem):
 
     """The Resource mixin class provides basic WebDAV support for
@@ -399,7 +403,11 @@
         parent._setObject(name, ob)
         ob = parent._getOb(name)
         ob._postCopy(parent, op=0)
-        ob.manage_afterClone(ob)
+
+        OFS.subscribers.compatibilityCall('manage_afterClone', ob, ob)
+
+        notify(ObjectClonedEvent(ob))
+
         # We remove any locks from the copied object because webdav clients
         # don't track the lock status and the lock token for copied resources
         ob.wl_clearLocks()

Copied: Zope/branches/whitmo-2.10-layers/lib/python/webdav/tests/testPUT_factory.py (from rev 70147, Zope/branches/2.10/lib/python/webdav/tests/testPUT_factory.py)

Modified: Zope/branches/whitmo-2.10-layers/setup.py
===================================================================
--- Zope/branches/whitmo-2.10-layers/setup.py	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/setup.py	2006-09-13 13:03:50 UTC (rev 70149)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
 
 ##############################################################################
 #
@@ -49,7 +49,8 @@
 from distutils.command.install_data import install_data
 from distutils.util import convert_path
 
-sys.path.insert(0, 'inst')
+where = os.path.split(__file__)[0]
+sys.path.insert(0, os.path.join(where, 'inst'))
 import versions
 del sys.path[0]
 

Modified: Zope/branches/whitmo-2.10-layers/skel/etc/site.zcml
===================================================================
--- Zope/branches/whitmo-2.10-layers/skel/etc/site.zcml	2006-09-13 13:02:06 UTC (rev 70148)
+++ Zope/branches/whitmo-2.10-layers/skel/etc/site.zcml	2006-09-13 13:03:50 UTC (rev 70149)
@@ -20,6 +20,7 @@
 
   <!-- Load the configuration overrides-->
 
+  <includeOverrides files="package-includes/*-overrides.zcml" />
   <five:loadProductsOverrides />
 
 </configure>



More information about the Zope-Checkins mailing list