[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Products/Five/
reversing webdav changes for alec
david whitfield Morriss
whit at longnow.org
Tue Feb 21 23:40:29 EST 2006
Log message for revision 41746:
reversing webdav changes for alec
Changed:
U Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py
U Zope/branches/2.9/lib/python/Products/Five/traversable.py
-=-
Modified: Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py 2006-02-22 04:10:25 UTC (rev 41745)
+++ Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py 2006-02-22 04:40:28 UTC (rev 41746)
@@ -114,52 +114,7 @@
...
an_attribute
- If we use WebDAV to get an object no acquisition should be performed,
- otherwise content creation will break:
-
- >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
- >>> manage_addFiveTraversableFolder(self.folder, 'traversable_folder', 'Traversable')
- Let's verify that we can get our object properties via WebDAV:
- >>> print http(r'''
- ... PROPFIND /test_folder_1_/fancy HTTP/1.1
- ... Content-Type: text/xml; charset="utf-8"
- ... Depth: 0
- ...
- ... <?xml version="1.0" encoding="utf-8"?>
- ... <DAV:propfind xmlns:DAV="DAV:"
- ... xmlns:zope="http://www.zope.org/propsets/default">
- ... <DAV:prop><zope:title/></DAV:prop>
- ... </DAV:propfind>
- ... ''')
- HTTP/1.1 200 OK
- ...
- PROPFIND
-
- And that a normal http request will acquire the object:
- >>> print http(r'''
- ... GET /test_folder_1_/traversable_folder/fancy HTTP/1.1
- ... ''')
- HTTP/1.1 200 OK
- ...
- <FancyContent at >
-
- But that a WebDAV request will not:
- >>> print http(r'''
- ... PROPFIND /test_folder_1_/traversable_folder/fancy HTTP/1.1
- ... Content-Type: text/xml; charset="utf-8"
- ... Depth: 0
- ...
- ... <?xml version="1.0" encoding="utf-8"?>
- ... <DAV:propfind xmlns:DAV="DAV:"
- ... xmlns:zope="http://www.zope.org/propsets/default">
- ... <DAV:prop><zope:title/></DAV:prop>
- ... </DAV:propfind>
- ... ''')
- HTTP/1.1 404 Not Found
- ...
-
-
Clean up:
>>> from zope.app.testing.placelesssetup import tearDown
Modified: Zope/branches/2.9/lib/python/Products/Five/traversable.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/Five/traversable.py 2006-02-22 04:10:25 UTC (rev 41745)
+++ Zope/branches/2.9/lib/python/Products/Five/traversable.py 2006-02-22 04:40:28 UTC (rev 41746)
@@ -33,8 +33,6 @@
from Acquisition import aq_base
from Products.Five.security import newInteraction
-from webdav.NullResource import NullResource
-
_marker = object
class FakeRequest(dict):
@@ -97,27 +95,14 @@
# potential WebDAV issues, in particular we should not perform
# acquisition for webdav requests, and should return a NullResource
# when appropriate.
- method = REQUEST.get('REQUEST_METHOD', 'GET').upper()
- if (len(REQUEST.get('TraversalRequestNameStack', ())) == 0 and
- not (method in ('GET', 'HEAD', 'POST') and not
- isinstance(REQUEST.RESPONSE, xmlrpc.Response))):
- if getattr(aq_base(self), name, None) is not None:
- return getattr(self, name)
- else:
- # XXX: This may be unnecessary as Zope itself doesn't do it,
- # but it shouldn't be harmful
- if (method in ('PUT', 'MKCOL') and not
- isinstance(RESPONSE, xmlrpc.Response)):
- return NullResource(self, name, REQUEST).__of__(self)
- else:
- try:
- return getattr(self, name)
- except AttributeError:
- pass
- try:
- return self[name]
- except (AttributeError, KeyError):
- pass
+ try:
+ return getattr(self, name)
+ except AttributeError:
+ pass
+ try:
+ return self[name]
+ except (AttributeError, KeyError):
+ pass
raise AttributeError, name
__bobo_traverse__.__five_method__ = True
More information about the Zope-Checkins
mailing list