[Zope-Checkins] CVS: Zope/lib/python/OFS - ObjectManager.py:1.143.2.1
Andreas Jung
andreas@zope.com
Tue, 6 Nov 2001 13:55:36 -0500
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv26250
Modified Files:
Tag: ajung-webdav-debug
ObjectManager.py
Log Message:
added Unlock functionality to ZMI
=== Zope/lib/python/OFS/ObjectManager.py 1.143 => 1.143.2.1 ===
from webdav.NullResource import NullResource
from webdav.Collection import Collection
+from webdav import davcmds
from Acquisition import aq_base
from urllib import quote
from cStringIO import StringIO
@@ -103,6 +104,7 @@
from AccessControl import getSecurityManager
from zLOG import LOG, ERROR
import sys,string,fnmatch,copy
+import types
import XMLExportImport
customImporters={
@@ -689,6 +691,62 @@
break
return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
+
+ def manage_lockObjects(self, ids=None, REQUEST=None, RESPONSE=None):
+ """ Lock selected objects """
+
+ if ids is None and REQUEST is not None:
+ return eNoItemsSpecified
+ elif ids is None:
+ raise ValueError, 'ids must be specified'
+
+ if isinstance(ids,types.StringType):
+ ids=[ids]
+
+ for id in ids:
+ print id
+
+ v=self._getOb(id, self)
+ if v is self:
+ raise 'BadRequest', '%s does not exist' % ids[-1]
+
+ cmd = davcmds.Lock(REQUEST)
+ token, result = cmd.apply(self, creator, depth=depth)
+ try:
+ cmd = davcmds.Lock(REQUEST)
+ token, result = cmd.apply(v)
+ print token,result
+
+ print 'locked'
+ except:
+ print sys.exc_type,sys.exc_value
+
+ return self.manage_main(self, REQUEST)
+
+
+ def manage_unlockObjects(self, ids=None, REQUEST=None, RESPONSE=None):
+ """ Lock selected objects """
+
+ if ids is None and REQUEST is not None:
+ return eNoItemsSpecified
+ elif ids is None:
+ raise ValueError, 'ids must be specified'
+
+ if isinstance(ids,types.StringType):
+ ids=[ids]
+
+ for id in ids:
+
+ v=self._getOb(id, self)
+ if v is self:
+ raise 'BadRequest', '%s does not exist' % ids[-1]
+
+ try: v.wl_clearLocks()
+ except: pass
+
+
+ return self.manage_main(self, REQUEST)
+
def __getitem__(self, key):
v=self._getOb(key, None)