[Zope] sending a mail in a ZClass constructor

Capesius, Alan CapesiusA@Sysmex.com
Thu, 26 Apr 2001 17:53:18 -0500


Try wrapping the DTML method code in:
<dtml-with "REQUEST.PARENTS[0]">

works for me, with: direct calls, xron triggers, and xron schedules.


>>>-----Original Message-----
>>>From: Jerome Alet [mailto:alet@unice.fr]
>>>Sent: Thursday, April 26, 2001 5:03 PM 
>>>To: zope@zope.org
>>>Subject: [Zope] sending a mail in a ZClass constructor
>>>
>>>
>>>Hi,
>>>
>>>I've got a MailHost in a Folder, which works fine when sending
>>>emails with methods that are in this Folder.
>>>
>>>Now I want to send an email every time someone creates 
>>>a new instance of a particular ZClass, so I've tried to call
>>>a method in the Folder in question in the MyClass_add DTML method
>>>in my ZClass definition.
>>>
>>>I've tried both <dtml-call "mymethod(_, REQUEST)">
>>>and <dtml-call mymethod> but with no luck:
>>>
>>>The problem is that the MailHost (called MailHost) is not found 
>>>(KeyError), but mymethod is found, it seems.
>>>
>>>FYI mymethod is just some DTML code containing a dtml-sendmail tag
>>>and a message body, and works when launched directly in the Folder.
>>>
>>>Does anyone have any idea ?
>>>
>>>Thanks in advance
>>>
>>>Jerome Alet
>>>
>>>_______________________________________________
>>>Zope maillist  -  Zope@zope.org
>>>http://lists.zope.org/mailman/listinfo/zope
>>>**   No cross posts or HTML encoding!  **
>>>(Related lists - 
>>> http://lists.zope.org/mailman/listinfo/zope-announce
>>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>>