[Zope-Checkins] CVS: Zope2 - Collection.py:1.20.22.1 NullResource.py:1.29.10.1 Resource.py:1.45.10.1 davcmds.py:1.13.22.1

andreas@serenade.digicool.com andreas@serenade.digicool.com
Mon, 2 Jul 2001 12:05:37 -0400


Update of /cvs-repository/Zope2/lib/python/webdav
In directory serenade:/tmp/cvs-serv13351/lib/python/webdav

Modified Files:
      Tag: ajung-webdav
	Collection.py NullResource.py Resource.py davcmds.py 
Log Message:
several fixes



--- Updated File Collection.py in package Zope2 --
--- Collection.py	2001/05/01 14:41:04	1.20
+++ Collection.py	2001/07/02 16:05:37	1.20.22.1
@@ -195,6 +195,7 @@
             if parent.manage_delObjects([name],REQUEST=None)  is None:
                 RESPONSE.setStatus(204)
             else:
+                print "403 pos1"
                 RESPONSE.setStatus(403)
             
         return RESPONSE

--- Updated File NullResource.py in package Zope2 --
--- NullResource.py	2001/06/07 22:18:46	1.29
+++ NullResource.py	2001/07/02 16:05:37	1.29.10.1
@@ -232,7 +232,7 @@
         creator = security.getUser()
         body = REQUEST.get('BODY', '')
         ifhdr = REQUEST.get_header('If', '')
-        depth = REQUEST.get_header('Depth', 'infinite')
+        depth = REQUEST.get_header('Depth', 'infinity')
 
         name = self.__name__
         parent = self.__parent__

--- Updated File Resource.py in package Zope2 --
--- Resource.py	2001/05/23 19:09:32	1.45
+++ Resource.py	2001/07/02 16:05:37	1.45.10.1
@@ -181,10 +181,19 @@
         found = 0; resourcetagged = 0
         taglist = IfParser(ifhdr)
         for tag in taglist:
+            print "tag",tag
             if not tag.resource:
                 # There's no resource (url) with this tag
-                taglist = map(tokenFinder, tag.list)
-                wehave = filter(havetag, list)
+                tag_list = map(tokenFinder, tag.list)
+
+
+                print "taglist",tag_list
+                try:
+                    wehave = filter(havetag, tag_list)
+                except:
+                    print sys.exc_type,sys.exc_value
+                    print "error"
+
                 if not wehave: continue
                 if tag.NOTTED: continue
                 if refresh:
@@ -193,8 +202,8 @@
                 found = 1; break
             elif urlbase(tag.resource) == url:
                 resourcetagged = 1
-                taglist = map(tokenFinder, tag.list)
-                wehave = filter(havetag, taglist)
+                tag_list = map(tokenFinder, tag.list)
+                wehave = filter(havetag, tag_list)
                 if not wehave: continue
                 if tag.NOTTED: continue
                 if refresh:
@@ -300,6 +309,7 @@
         if parent.manage_delObjects([name],REQUEST=None)  is None:
             RESPONSE.setStatus(204)
         else:
+            print "403 pos2"
             RESPONSE.setStatus(403)
 
         return RESPONSE
@@ -538,7 +548,7 @@
         creator = security.getUser()
         body = REQUEST.get('BODY', '')
         ifhdr = REQUEST.get_header('If', None)
-        depth = REQUEST.get_header('Depth', 'infinite')
+        depth = REQUEST.get_header('Depth', 'infinity')
         alreadylocked = Lockable.wl_isLocked(self)
 
         if body and alreadylocked:

--- Updated File davcmds.py in package Zope2 --
--- davcmds.py	2001/04/27 18:07:19	1.13
+++ davcmds.py	2001/07/02 16:05:37	1.13.22.1
@@ -352,7 +352,7 @@
         self.scope = 'exclusive'
         self.type = 'write'
         self.owner = ''
-        timeout = request.get_header('Timeout', 'Infinite')
+        timeout = request.get_header('Timeout', 'infinity')
         self.timeout = string.strip(string.split(timeout,',')[-1])
         self.parse(data)
 
@@ -383,11 +383,21 @@
                 else:
                     el.remap({dav:'o'})
             self.owner = lockowner.strval()
+            print "got owner",self.owner
 
     def apply(self, obj, creator=None, depth='infinity', token=None,
               result=None, url=None, top=1):
         """ Apply, built for recursion (so that we may lock subitems
         of a collection if requested """
+
+
+        print "obj",obj
+        print "creator",creator
+        print "token",token
+        print "depth",depth
+
+#        import pdb
+#        pdb.set_trace()
         if result is None:
             result = StringIO()
             url = urlfix(self.request['URL'], 'LOCK')
@@ -401,9 +411,13 @@
             lock = LockItem(creator, self.owner, depth, self.timeout,
                             self.type, self.scope, token)
             if token is None: token = lock.getLockToken()
+            print "got token:",token
         except ValueError, valerrors:
+            print sys.exc_type,sys.exc_value
             errmsg = "412 Precondition Failed"
         except:
+            print sys.exc_type,sys.exc_value
+            print "403 pos3"
             errmsg = "403 Forbidden"
 
         try:
@@ -420,13 +434,19 @@
                 errmsg = "423 Locked"
             else:
                 method = getattr(obj, 'wl_setLock')
+                print 'token',token
+                print 'method',method
+                print 'obj',obj
                 vld = getSecurityManager().validate(None, obj, 'wl_setLock',
                                                     method)
+                print "vld",vld
                 if vld and token and (lock is not None):
                     obj.wl_setLock(token, lock)
                 else:
+                    print "403 pos4"
                     errmsg = "403 Forbidden"
         except:
+            print "403 pos5"
             errmsg = "403 Forbidden"
             
         if errmsg:
@@ -475,7 +495,9 @@
             method = getattr(obj, 'wl_delLock')
             vld = getSecurityManager().validate(None,obj,'wl_delLock',method)
             if vld: obj.wl_delLock(token)
-            else: errmsg = "403 Forbidden"
+            else: 
+                errmsg = "403 Forbidden"
+                print "403 pos6"
         elif not islockable:
             # Only set an error message if the command is being applied
             # to a top level object.  Otherwise, we're descending a tree
@@ -529,6 +551,7 @@
         islockable = WriteLockInterface.isImplementedBy(obj)
         if parent and (not user.has_permission('Delete objects', parent)):
             # User doesn't have permission to delete this object
+            print "403 pos 7"
             errmsg = "403 Forbidden"
         elif islockable and obj.wl_isLocked():
             if token and obj.wl_hasLock(token):