[Zope] Lock and Transaction in Zope.

Aitor Grajal Aitor.Grajal@teleline.es
Wed, 06 Sep 2000 15:51:10 +0200


--=====_9682482706334=_
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

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=3D=3D0">
  <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=3D=3D0"> 
  <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.


--=====_9682482706334=_
Content-Type: text/html; charset="us-ascii"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff style="FONT-FAMILY: Arial" text=#000000>
<DIV><FONT size=2>I think I know how to manage transactions in Zope, but I don't 
know how to lock Zope resources for multiple requests.</FONT></DIV>
<DIV><FONT size=2>For example :</FONT></DIV>
<DIV><FONT size=2>I have a DTML Method, called "transac1", which looks like this 
:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>&lt;dtml-if "var==0"&gt;<BR>&nbsp; &lt;dtml-call 
wait_10_seconds&gt;<BR>&nbsp; "waiting 10 seconds..."<BR>&nbsp; &lt;dtml-call 
"manage_editProperties({'var':1})"&gt;<BR>&lt;/dtml-if&gt;<BR></FONT></DIV>
<DIV><FONT size=2>wait_10_seconds is an External Method that sleeps for 10 
seconds.</FONT></DIV>
<DIV><FONT size=2>In the other hand, I have another method, called "transac2" 
:</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>&lt;dtml-if "var==0"&gt; <BR>&nbsp; &lt;dtml-call 
"manage_editProperties({'var':2})"&gt;<BR>&lt;dtml-else&gt;<BR>&nbsp; 
&lt;dtml-call 
"manage_editProperties({'var':3})"&gt;<BR>&lt;/dtml-if&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>In the parent Folder, there's a property called "var" which I 
use in these methods. It has an initial value of 0.</FONT></DIV>
<DIV><FONT size=2>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.</FONT></DIV>
<DIV><FONT size=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 
w</FONT><FONT size=2>here can I find information about locking resources in 
Zope.</DIV></FONT></BODY></HTML>


--=====_9682482706334=_--