[Zope] sending a mail in a ZClass constructor

Jerome Alet alet@unice.fr
Fri, 27 Apr 2001 15:08:45 +0200 (MET DST)


On Thu, 26 Apr 2001, Capesius, Alan wrote:

> Try wrapping the DTML method code in:
> <dtml-with "REQUEST.PARENTS[0]">
> 
> works for me, with: direct calls, xron triggers, and xron schedules.

Doesn't work here, here's the tree:

	Folder_A
	|
	|---- Folder_B
	|---- Folder_C
        |     |---- Folder_D
        |           |---- MyFolder
	|---- MailHost
	|---- MyMethod

and here's what's in the MyClass_add DTML Method in the Control Panel:

 <dtml-with CreateInObjectManager ...> 
   <dtml-with "REQUEST.PARENTS[0]">
     <dtml-call MyMethod>
   </dtml-with>
 </dtml-with>

The purpose is to call MyMethod which is in Folder_A whenever a member
adds an instance of MyClass in his own folder, which may be anywhere (e.g. 
MyFolder), then MyMethod uses the MailHost (named MailHost) defined in
Folder_A to send an email to a "moderator" in order for him to know
there's a new object. 

MyMethod looks like:

<dtml-sendmail mailhost="MailHost">
  ...
</dtml-sendmail>

When called manually MyMethod works, but when called from MyClass_add it
gives me a KeyError, not finding the object named MailHost.

What's wrong ?

thx.

Jerome Alet