Lock and Transaction in Zope.
I think I know how to manage transactions in Zope, but I don't know how to lock Zope resources for multiple requests. For example : I have a DTML Method, called "transac1", which looks like this : <dtml-if "var==0"> <dtml-call wait_10_seconds> "waiting 10 seconds..." <dtml-call "manage_editProperties({'var':1})"> </dtml-if> wait_10_seconds is an External Method that sleeps for 10 seconds. In the other hand, I have another method, called "transac2" : <dtml-if "var==0"> <dtml-call "manage_editProperties({'var':2})"> <dtml-else> <dtml-call "manage_editProperties({'var':3})"> </dtml-if> In the parent Folder, there's a property called "var" which I use in these methods. It has an initial value of 0. The point is : if I call the first method, and while it's sleeping, I call the second one (from another window, for example), it doesn't work properly. The first one crashes, and doesn't finish right. The final "var" value is 2. I want to know if there is any way to lock the folder, and its properties, so no one can access to it until my method "transac1" finishes, and where can I find information about locking resources in Zope.
Zope has no built in locking like that, but IIRC there was some hack in the wiki code to prevent simultaneous editing (which wasn't bullet proof). Perhaps you can look there. I doubt whether it will solve the problem you pose, but I don't see why you'd want to do what you pointed out in your mail anyway. Rik
participants (2)
-
Aitor Grajal -
Rik Hoekstra