[Zope-Checkins] CVS: Zope/lib/python/webdav - common.py:1.12.2.2

Andreas Jung andreas@digicool.com
Wed, 9 Jan 2002 13:18:32 -0500


Update of /cvs-repository/Zope/lib/python/webdav
In directory cvs.zope.org:/tmp/cvs-serv18188

Modified Files:
      Tag: Zope-2_5-branch
	common.py 
Log Message:
change method to create lock token to be more random


=== Zope/lib/python/webdav/common.py 1.12.2.1 => 1.12.2.2 ===
 from App.Common import iso8601_date, rfc850_date, rfc1123_date
 from App.Common import aq_base
+import random
+
+_randGen = random.Random(time.time())
 
 def absattr(attr):
     if callable(attr):
@@ -53,10 +56,10 @@
 
 def generateLockToken():
     # Generate a lock token
-    # XXX This is simple right now, just lifted from the original shortcut
-    # in Resource.dav__genlocktoken, but should be replaced by something
-    # better.
-    return 'AA9F6414-1D77-11D3-B825-00105A989226:%.03f' % time.time()
+    return '%s-%s-00105A989226:%.03f' %  \
+         (_randGen.random(),_randGen.random(),time.time())
+
+    
 
 def tokenFinder(token):
     # takes a string like '<opaquelocktoken:afsdfadfadf> and returns the token