[CMF-checkins] CVS: CMF/CMFStaging - LockTool.py:1.16

Shane Hathaway shane at zope.com
Thu Jan 29 18:12:55 EST 2004


Update of /cvs-repository/CMF/CMFStaging
In directory cvs.zope.org:/tmp/cvs-serv14447

Modified Files:
	LockTool.py 
Log Message:
Added a hasLock() convenience method.


=== CMF/CMFStaging/LockTool.py 1.15 => 1.16 ===
--- CMF/CMFStaging/LockTool.py:1.15	Fri Jan 23 10:16:15 2004
+++ CMF/CMFStaging/LockTool.py	Thu Jan 29 18:12:54 2004
@@ -240,5 +240,15 @@
                 return 0
         return 1
 
-InitializeClass(LockTool)
 
+    security.declarePublic('hasLock')
+    def hasLock(self, obj):
+        """Returns true if the user has a lock on the specified object.
+        """
+        locker = self.locker(obj)
+        if not locker:
+            return 0
+        user = getSecurityManager().getUser()
+        return (user.getId() == locker)
+
+InitializeClass(LockTool)




More information about the CMF-checkins mailing list