Christian Steinhauer wrote at 2006-11-24 13:12 +0100:
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@mail.com", "sender@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@mail.com", "sender@mail.com", subj) return 'eof' #### end ####
Do you call your script directly from a browser? In this case, a browser problem may be the reason for your observation. The first variant (lacking a return) will effectively return "None", a Python false value. The ZPublisher will turn any Python false value into a 205 response ("no content"). Almost all browsers, I have met so far, handle 205 responses in a buggy way. Maybe, your browser will repeat the call... I have seen several problem reports in mailing lists complaining that IE under some (still obscur) circumstances repeat a request. You should look into your "Z2.log" file (you may need to enable it in the Zope configuration file) and verify whether your requests are doubled.... -- Dieter