New user - couple of questions
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
Paolo Quaglia wrote:
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!!"
Better if you write this function like this: import time def hello(self): time.sleep(10) return "I'm Back!!"
1. give it a name, say pippo.py 2. then go back to your zope and add an External Method 3. put id=pluto 4. function name=hello 5. python module=pippo 6. save it
If you want to try it create a DTML Document for example and put in it the the following command: <dtml-var pluto> and then view the DTML Document, after a while i.e. 10 secs you will see the message: 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:... If I am not mistaken, zope works all the time in transaction mode, then you don't need to expecify transactions at all.
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 advancePaolo QuagliaSitek Spa Italy Paolo Quaglia Information Technology Coordinator Sitek S.p.A. paolo@sitek.it
Ciao José Soares - Italy
participants (2)
-
Jose Soares -
Paolo Quaglia