Help! I have a python script, which calls a dtml-method, which invokes a zpt. The dtml-method is constructing an HTML email for me, and the zpt is the body of the email. I want to be able to have the dtml method use different page templates, so I can send different pages (each of these is a report). So for this I have a <dtml-var email>, and <dtml-var "_[reportid]"> variables. By scrounging around the web, and looking at other source, and some docs, I've gotten some of my DTML/email needs handled. But I'm stuck now. When I try to execute my python script, I get a KeyError on the page template I'm trying to load, even though the page template is in the same directory as the dtml-method. So, for example, the dtml-method is called 'sendreport', and the zpt I wish to send is called 'salessummary'. In the python script, I have this: args = {} args["email"] = container.get_recipient_list() args["reportid"] = "salessummary" container.sendreport(None, context.REQUEST, args) Firstly - I'm not sure why the 'None, context.REQUEST' arguments come first when invoking the DTML method, though it seems to work in another case I have, and I got this from some presumably working code. Can anyone point me to documentation on how a python script is supposed to invoke a DTML method? Secondly, when I do this, I get a KeyError on 'salessummary' - even though it's sitting in the same directory as the DTML method. This is *really* frustrating, as this seems to be counterintuitive behavior (based on Zope's hierarchy rules). Any help, suggestions or pointers (even a RTFM, as long as I know which FM to read) would be greatly appreciated. Thanks! Colin -- Colin Fox cfox@cfconsulting.ca CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Colin Fox wrote:
Help! I have a python script, which calls a dtml-method, which invokes a zpt.
[...]
container.sendreport(None, context.REQUEST, args)
Can't guarantee that this is right, or will fix your problem, but I think you are calling the dtml-method incorrectly. Try: container.sendreport(context, context.REQUEST, args) If I recall correctly, the first positional argument must be the 'client' object (context). If that's right, passing in 'None' instead would seem likely to lead to KeyErrors as the None object doesn't have a 'sendreport' attribute. hth, tim
participants (2)
-
Colin Fox -
Tim Hicks