[ZCM] [ZC] 2245/ 1 Request "error with simple python script loop "

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]>
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2245 Update (Request) "error with simple python script loop "
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2245

==============================================================
= Request - Entry #1 by knowit on Nov 24, 2006 6:57 am

I have an problem with this little script. The script is in the zope file structure and it is  an -Script (Python)- 

The script should send 2 emails over the mailhost, but it sends 4 emails. I have test this with maildrophost product too, same problem. I have test it on Zope 2.10.0 and Zope 2.64. The problem is the same - everytime. 

This script produce the error:
#### start ####
for i in range(2):
  subj = str(i) + ' range python'
  context.MailHost.send('range test with python', "[email protected]", "[email protected]", subj)
#### end ####

This script produce no error: 
#### start ####
for i in range(2):
  subj = str(i) + ' range python'
  context.MailHost.send('range test with python', "[email protected]", "[email protected]", subj)
return 'eof'
#### end ####

So if i make a return (not in the loop) the script works fine. 
Can anybody tell me why? It feels like that there are any spaces in the script and zope/python did not work correctly when there is no other procedure after the for loop. I dont understand why he calls the loop two times and produce 4 emails. There is no transactional error in the error_log.

thx for help





==============================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.