[Zope] error with simple python script loop

Christian Steinhauer steinhauer at know-it.net
Fri Nov 24 07:12:07 EST 2006


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', "rec at mail.com",
"sender at mail.com", 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', "rec at mail.com",
"sender at mail.com", 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


More information about the Zope mailing list