[Zope3-checkins] SVN: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py Clean up logic of depthRecurse method.

Martijn Pieters mj at zopatista.com
Mon Oct 11 06:19:20 EDT 2004


Log message for revision 27952:
  Clean up logic of depthRecurse method.
  


Changed:
  U   Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py


-=-
Modified: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py
===================================================================
--- Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py	2004-10-11 10:14:20 UTC (rev 27951)
+++ Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py	2004-10-11 10:19:20 UTC (rev 27952)
@@ -95,22 +95,20 @@
 
     def _depthRecurse(self, ms):
         depth = self.getDepth()
-        if depth == '1':
-            subdepth = '0'
-        if depth == 'infinity':
-            subdepth = 'infinity'
-        if depth != '0':
-            if IReadContainer.providedBy(self.context):
-                for id, obj in self.context.items():
-                    pfind = zapi.queryView(obj, 'PROPFIND', self.request, None)
-                    if pfind is not None:
-                        pfind.setDepth(subdepth)
-                        value = pfind.PROPFIND()
-                        parsed = minidom.parseString(value)
-                        responses = parsed.getElementsByTagNameNS(
-                            self.default_ns, 'response')
-                        for r in responses:
-                            ms.appendChild(r)
+        if depth == '0' or not IReadContainer.providedBy(self.context):
+            return
+        subdepth = (depth == '1') and '0' or 'infinity'
+        for id, obj in self.context.items():
+            pfind = zapi.queryView(obj, 'PROPFIND', self.request, None)
+            if pfind is None:
+                continue
+            pfind.setDepth(subdepth)
+            value = pfind.PROPFIND()
+            parsed = minidom.parseString(value)
+            responses = parsed.getElementsByTagNameNS(
+                self.default_ns, 'response')
+            for r in responses:
+                ms.appendChild(r)
 
     def _handleProp(self, source):
         props = {}



More information about the Zope3-Checkins mailing list