Hey, all. I'm invoking a dtml-method from a script, and the dtml-method has a dtml-sendmail call within it. I'm getting a Error Type: KeyError Error Value: MailHost when I try to execute my dtml-method. I have a MailHost object in the parent directory. I was assuming that acquisition would allow a subfolder to see the root folder's MailHost object. Am I wrong? I have another dtml method in my root folder, and that successfully sends out emails with the same MailHost object, so I know the MailHost configuration, and my sendmail configuration, is fine. One other difference is that the root folder dtml method is invoked by another dtml method, and the dtml method in my subfolder is invoked by a script. Does that make a difference? TIA, Colin -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Hello Colin, Thursday, May 23, 2002, 7:30:17 AM, you wrote: CF> Hey, all. CF> I'm invoking a dtml-method from a script, and the dtml-method has a CF> dtml-sendmail call within it. CF> I'm getting a CF> Error Type: KeyError CF> Error Value: MailHost CF> when I try to execute my dtml-method. I have a MailHost object in the CF> parent directory. CF> I was assuming that acquisition would allow a subfolder to see the root CF> folder's MailHost object. Am I wrong? Your assumption on acquisition is correct. My guess is that you have been bitten by the same issue that tricked me a couple of times earlier : Probably , you just don't have the necessary permissions to use/see/acquire the mailhost. Try giving your dtml-method a proxy role of manager to check if this is the case , - you can tweak permission settings more specifically later , after you isolated this to be the problem.. :-) -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
On Thu, 2002-05-23 at 01:29, Geir Bækholt wrote:
Hello Colin, <..>
Your assumption on acquisition is correct. My guess is that you have been bitten by the same issue that tricked me a couple of times earlier :
Probably , you just don't have the necessary permissions to use/see/acquire the mailhost. Try giving your dtml-method a proxy role of manager to check if this is the case , - you can tweak permission settings more specifically later , after you isolated this to be the problem..
Actually, my script already has the Manager proxy role. I started with my other (working) script and copied it, which also copied the role settings. Another question I had was can I simply call a dtml method as a function? ie, if I have a dtml method called 'send_some_email', and it expects to be able to use <dtml-var email_addr>, can I simply call (from a script): context.send_some_email(email_addr='someone@yahoo.com') I can't seem to find docs on calling dtml methods from python scripts. Lots of stuff about python scripts from dtml methods, though. Does anyone else find the Zope documentation difficult to find answers in? The Beazley Python book is organized nicely for answering questions. It'd be nice to see a similar organization. I seem to spend a lot of time looking for answers to straightforward questions, like "can I invoke the MailHost object from a python script? If so, how? How do I respond to exceptions? What exceptions are thrown, and what are the parameters that go along with them?" TIA, Colin -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Hello Colin, Thursday, May 23, 2002, 7:42:56 PM, you wrote: CF> Another question I had was can I simply call a dtml method as a CF> function? ie, if I have a dtml method called 'send_some_email', and it CF> expects to be able to use <dtml-var email_addr>, can I simply call (from CF> a script): CF> context.send_some_email(email_addr='someone@yahoo.com') CF> I can't seem to find docs on calling dtml methods from python scripts. CF> Lots of stuff about python scripts from dtml methods, though. this ought to help : Call DTML from (Script) Python by : runyaga (thanks man , you're great with those recipies !) http://www.zopelabs.com/cookbook/992031125 as for documentation: try zopelabs first, when you're trying to figure something out.. I find these examples very helpful getting stuff done, and rather use the APIs and the source for more specific stuff afterwards.. -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
participants (2)
-
Colin Fox -
Geir Bækholt