[Zope-Checkins] SVN: Zope/trunk/ Revert code that fixed litmus cond_put_corrupt_token and fail_cond_put_unlock tests, because the fix broke (the more important) lock_collection test.

Chris McDonough chrism at plope.com
Sun Jun 17 18:36:51 EDT 2007


Log message for revision 76746:
  Revert code that fixed litmus cond_put_corrupt_token and fail_cond_put_unlock tests, because the fix broke (the more important) lock_collection test.
  
  Add a description of the current litmus failures in webdav/litmus-results.txt.
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/webdav/Resource.py
  U   Zope/trunk/lib/python/webdav/tests/testResource.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2007-06-17 21:45:31 UTC (rev 76745)
+++ Zope/trunk/doc/CHANGES.txt	2007-06-17 22:36:50 UTC (rev 76746)
@@ -97,19 +97,6 @@
 
     Bugs Fixed
 
-      - DAV: litmus' cond_put_unlocked test (#22) exposed a bug in
-        webdav.Resource.dav__simpleifhandler.  If the resource is not
-        locked, and a DAV request contains an If header, no token can
-        possibly match and we must return a 412 Precondition Failed
-        instead of 204 No Content.
-
-      - DAV: litmus' cond_put_corrupt_token test (#18) exposed a bug
-        in webdav.Resource.dav__simpleifhandler.  If the resource is
-        locked at all, and a DAV request contains an If header, and
-        none of the lock tokens present in the header match a lock on
-        the resource, we need to return a 423 Locked instead of 204 No
-        Content.
-
       - DAV: litmus "notowner_modify" tests warn during a MOVE request
         because we returned "412 Precondition Failed" instead of "423
         Locked" when the resource attempting to be moved was itself
@@ -262,6 +249,9 @@
       - Returned to the "classic" './configure && make && make install'
         recipe, dropping the use of 'zpkg' for building Zope2 releases.
 
+      - Added lib/python/webdav/litmus-results.txt explaining current
+        test results from the litmus WebDAV torture test.
+
   Zope 2.10.0 beta 1 (2006/05/30)
 
     Restructuring

Modified: Zope/trunk/lib/python/webdav/Resource.py
===================================================================
--- Zope/trunk/lib/python/webdav/Resource.py	2007-06-17 21:45:31 UTC (rev 76745)
+++ Zope/trunk/lib/python/webdav/Resource.py	2007-06-17 22:36:50 UTC (rev 76746)
@@ -127,13 +127,6 @@
         if not ifhdr:
             return None
 
-        if (not locked):
-            # we have an if header but the resource isn't locked, we
-            # can shortcut checking the tags in the if header; no token
-            # can possibly match
-            raise PreconditionFailed(
-                'Resource not locked but If header specified')
-
         # Since we're a simple if handler, and since some clients don't
         # pass in the port information in the resource part of an If
         # header, we're only going to worry about if the paths compare
@@ -172,12 +165,12 @@
                     for token in wehave: self.wl_getLock(token).refresh()
                 found = 1; break
 
-        if resourcetagged and found:
+        if resourcetagged and (not found):
+            raise PreconditionFailed, 'Condition failed.'
+        elif resourcetagged and found:
             return 1
-        if (not resourcetagged) and (not found):
-            raise Locked('Resource locked and no recognized lock tokens in '
-                         'If header')
-        raise PreconditionFailed('Condition failed')
+        else:
+            return 0
 
     # WebDAV class 1 support
     security.declareProtected(View, 'HEAD')

Modified: Zope/trunk/lib/python/webdav/tests/testResource.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testResource.py	2007-06-17 21:45:31 UTC (rev 76745)
+++ Zope/trunk/lib/python/webdav/tests/testResource.py	2007-06-17 22:36:50 UTC (rev 76746)
@@ -56,13 +56,17 @@
         from webdav.common import Locked
         self.assertRaises(Locked, inst.MOVE, request, response)
 
-    def test_dav__simpleifhandler_fail_cond_put_unlocked(self):
+    def dont_test_dav__simpleifhandler_fail_cond_put_unlocked(self):
         """
         DAV: litmus' cond_put_unlocked test (#22) exposed a bug in
         webdav.Resource.dav__simpleifhandler.  If the resource is not
         locked, and a DAV request contains an If header, no token can
         possibly match and we must return a 412 Precondition Failed
         instead of 204 No Content.
+
+        I (chrism) haven't been able to make this work properly
+        without breaking other litmus tests (32. lock_collection being
+        the most important), so this test is not currently running.
         """
         ifhdr = 'If: (<locktoken:foo>)'
         request = DummyRequest({'URL':'http://example.com/foo/PUT'},
@@ -76,7 +80,7 @@
         self.assertRaises(PreconditionFailed, inst.dav__simpleifhandler,
                           request, response)
 
-    def test_dav__simpleifhandler_cond_put_corrupt_token(self):
+    def dont_test_dav__simpleifhandler_cond_put_corrupt_token(self):
         """
         DAV: litmus' cond_put_corrupt_token test (#18) exposed a bug
         in webdav.Resource.dav__simpleifhandler.  If the resource is
@@ -84,6 +88,10 @@
         none of the lock tokens present in the header match a lock on
         the resource, we need to return a 423 Locked instead of 204 No
         Content.
+
+        I (chrism) haven't been able to make this work properly
+        without breaking other litmus tests (32. lock_collection being
+        the most important), so this test is not currently running.
         """
         ifhdr = 'If: (<locktoken:foo>) (Not <DAV:no-lock>)'
         request = DummyRequest({'URL':'http://example.com/foo/PUT'},



More information about the Zope-Checkins mailing list