[Zope] New user - couple of questions

Paolo Quaglia paolo@sitek.it
Wed, 6 Dec 2000 11:17:47 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0040_01C05F76.29A36E50
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi to all,
I'm a new Zope user/developer ... Zope has impressed me very much!

Ihave a couple of questions.
I want to build a new intranet site for my company using Zope, but:

1. How can I import and use Python modules
For example I want to use the function sleep(secs) that resides in the time
module.
I wrote this code:

import time

def hello(self):
 sleep(10)
 return "I'm Back!!"

but when I call the external method bounded with the hello function an error
occours!!
1st. Have I to install the time module?
    - if yes where can I found it and where can I install it?
2nd. How do I have to call the sleep function?

2. I want to build an application that use the database transection to
update rows.
I use SQL server that support DB transactions.
where can I build SQL transactions with Zope?
do I have to build a ZSQL method with multiple SQL calls? .. for example:

...
begin transaction

<dtml-var sql_delimiter>

update t_cliente set primaetichinterna = 'mia'

<dtml-var sql_delimiter>

commit
....

Am I sure that the transaction will work (if another user use the same
method at the same time)?
How can I test if a transaction has been committed or aborted?

Thanks VERY MUCH in advance

Paolo Quaglia
Sitek Spa Italy



Paolo Quaglia
Information Technology Coordinator
Sitek S.p.A.
paolo@sitek.it



------=_NextPart_000_0040_01C05F76.29A36E50
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>Hi to=20
all,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>I'm a =
new Zope=20
user/developer ... Zope has impressed me very much!</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>Ihave =
a couple of=20
questions.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>I want =
to build a=20
new intranet site for my company using Zope, but:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>1. How =
can=20
I&nbsp;import and use Python modules </SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>For =
example I want=20
to use the&nbsp;function <EM>sleep(secs) </EM>that resides in the=20
<STRONG>time</STRONG> module.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D948180210-06122000>I&nbsp;wrote this=20
code:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>import time</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>def =
hello(self):<BR>&nbsp;sleep(10)<BR>&nbsp;return=20
"I'm Back!!"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>but =
when I call the=20
external method bounded with the hello function an error=20
occours!!</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>1st. =
Have I to=20
install the time module?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D948180210-06122000>&nbsp;&nbsp;&nbsp; -=20
if yes where can I found it and where can I install =
it?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>2nd. =
How do I have=20
to call the sleep function?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>2. I =
want to build=20
an application that use the database transection to update=20
rows.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D948180210-06122000></SPAN></FONT><FONT=20
face=3DArial size=3D2><SPAN class=3D948180210-06122000>I use SQL server =
that support=20
DB transactions.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>where =
can I build=20
SQL transactions with Zope? </SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>do I =
have to build a=20
ZSQL method with multiple SQL calls? .. for example:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000>...</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>begin=20
transaction</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D948180210-06122000>&lt;dtml-var=20
sql_delimiter&gt;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>update =
t_cliente set=20
primaetichinterna =3D 'mia'</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D948180210-06122000>&lt;dtml-var=20
sql_delimiter&gt;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000>commit</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000>....</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>Am I =
sure that the=20
transaction will work (if another user use the same method at the same=20
time)?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D948180210-06122000>How&nbsp;can I test=20
if&nbsp;a transaction has been committed or aborted?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>Thanks =
VERY MUCH in=20
advance</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D948180210-06122000>Paolo=20
Quaglia</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sitek Spa Italy</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D948180210-06122000></SPAN></FONT>&nbsp;</DIV>
<P><FONT face=3DArial size=3D2>Paolo Quaglia<BR>Information Technology=20
Coordinator<BR>Sitek S.p.A.<BR>paolo@sitek.it </FONT></P>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0040_01C05F76.29A36E50--