RE: [Zope] sending a mail in a ZClass constructor
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 )
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
participants (2)
-
Capesius, Alan -
Jerome Alet