Log message for revision 72040:
  Fix for collector #2261. At least an ugly temporary fix. This could be 
cleaned up a 
  lot, but even better, we should take further steps towards using the z3 
publisher.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZPublisher/BaseRequest.py
  U   Zope/trunk/lib/python/webdav/tests/testPUT_factory.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt  2007-01-15 11:58:02 UTC (rev 72039)
+++ Zope/trunk/doc/CHANGES.txt  2007-01-15 15:01:56 UTC (rev 72040)
@@ -72,6 +72,7 @@
         interfaces.py)
 
     Bugs Fixed
+      - Collector #2261: Acquisition when creating objects via Webdav.
 
       - Collector #2263: 'field2ulines' did not convert empty string
         correctly.

Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py     2007-01-15 11:58:02 UTC 
(rev 72039)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py     2007-01-15 15:01:56 UTC 
(rev 72040)
@@ -427,6 +427,17 @@
                     # BrowserDefault returns the object to be published
                     # (usually self) and a sequence of names to traverse to
                     # find the method to be published.
+                    
+                    # This is webdav support. The last object in the path
+                    # should not be acquired. Instead, a NullResource should
+                    # be given if it doesn't exist:
+                    if (no_acquire_flag and
+                        hasattr(object, 'aq_base') and 
+                        not hasattr(object,'__bobo_traverse__')):
+                        if object.aq_parent is not object.aq_inner.aq_parent:
+                            from webdav.NullResource import NullResource
+                            object = NullResource(parents[-2], object.getId(), 
self).__of__(parents[-2])
+                    
                     if IBrowserPublisher.providedBy(object):
                         adapter = object
                     else:

Modified: Zope/trunk/lib/python/webdav/tests/testPUT_factory.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testPUT_factory.py       2007-01-15 
11:58:02 UTC (rev 72039)
+++ Zope/trunk/lib/python/webdav/tests/testPUT_factory.py       2007-01-15 
15:01:56 UTC (rev 72040)
@@ -80,7 +80,7 @@
         put = request.traverse('/A/B/a')
         put(request, request.RESPONSE)
         # PUT should no acquire A.a
-        self.assertEqual(str(self.app.A.a), 'I am file a', 'PUT factory not 
should acquire content')
+        self.assertEqual(str(self.app.A.a), 'I am file a', 'PUT factory should 
not acquire content')
         # check for the newly created file
         self.assertEqual(str(self.app.A.B.a), 'bar')
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to