Re: [Zope] Trapping exceptions

2006-02-28 Thread Maciej Wisniowski

Tony Middleton wrote:



This gave error global name 'SMTPSenderRefused' is not defined

I tried importing smtplib and adding it to the except line and then 
got a permissions problem.


You are not allowed to access SMTPSenderRefused in this context

I'd appreciate any help with this.

You may put this code into external method - then you'll have no problem 
with permissions
or, if you really need this, you may declare necessary modules as 
permitted to Zope - this is

described in Products/PythonScripts/module_access_examples.py.

--
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Trapping exceptions

2006-02-28 Thread Tony Middleton
Sorry if this is a silly question but I've not found anything via Google 
or zope.org.


I am using a MailHost in a Python script.  I need to trap error conditions.

When I run without trapping I can get exception SMTPSenderRefused.

I inserted trapping - eg

  try:
context.mailman.send(vmessage,mto=vto,mfrom=vfrom,subject='Message 
from web site')

  except SMTPSenderRefused:
vsenderok=False
  else:
vsenderok=True

This gave error global name 'SMTPSenderRefused' is not defined

I tried importing smtplib and adding it to the except line and then got 
a permissions problem.


You are not allowed to access SMTPSenderRefused in this context

I'd appreciate any help with this.

Regards

Tony

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )