[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #2261:
Acquisition when creating objects via Webdav.
Andreas Jung
andreas at andreas-jung.com
Mon Jan 15 13:35:53 EST 2007
Log message for revision 72041:
- Collector #2261: Acquisition when creating objects via Webdav.
Changed:
U Zope/branches/2.10/doc/CHANGES.txt
U Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
U Zope/branches/2.10/lib/python/webdav/tests/testPUT_factory.py
-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt 2007-01-15 15:01:56 UTC (rev 72040)
+++ Zope/branches/2.10/doc/CHANGES.txt 2007-01-15 18:35:52 UTC (rev 72041)
@@ -10,6 +10,8 @@
- Updated Zope 3 to bugfix release 3.3.1.
+ - Collector #2261: Acquisition when creating objects via Webdav.
+
Zope 2.10.2 beta 1 (2007/01/14)
Bugs fixed
Modified: Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py 2007-01-15 15:01:56 UTC (rev 72040)
+++ Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py 2007-01-15 18:35:52 UTC (rev 72041)
@@ -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/branches/2.10/lib/python/webdav/tests/testPUT_factory.py
===================================================================
--- Zope/branches/2.10/lib/python/webdav/tests/testPUT_factory.py 2007-01-15 15:01:56 UTC (rev 72040)
+++ Zope/branches/2.10/lib/python/webdav/tests/testPUT_factory.py 2007-01-15 18:35:52 UTC (rev 72041)
@@ -27,6 +27,7 @@
request['BODY'] = 'bar'
request.environ['CONTENT_TYPE'] = 'text/plain'
request.environ['REQUEST_METHOD'] = 'PUT'
+ request.environ['WEBDAV_SOURCE_PORT'] = 1
request._auth = auth_info
except:
self.tearDown()
@@ -67,7 +68,24 @@
put(request, request.RESPONSE)
self.failUnless('doc' in self.folder.objectIds())
+ def testCollector2261(self):
+ from OFS.Folder import manage_addFolder
+ from OFS.DTMLMethod import addDTMLMethod
+ self.app.manage_addFolder('A', '')
+ addDTMLMethod(self.app, 'a', file='I am file a')
+ self.app.A.manage_addFolder('B', '')
+ request = self.app.REQUEST
+ # this should create 'a' within /A/B containing 'bar'
+ 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')
+ # check for the newly created file
+ self.assertEqual(str(self.app.A.B.a), 'bar')
+
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TestPUTFactory),
More information about the Zope-Checkins
mailing list