[Zope-CMF] dtml-sendmail equiv in page templates?

Tres Seaver tseaver@zope.com
Sat, 20 Apr 2002 10:13:32 -0400

Carl Rendell wrote:
> I'm down to the final steps of 100% conversion to page templates from 
> dtml. The only thing I've not been able to find is an equivalent script 
> and page template example that mimics the behavior of the 
> <dtml-sendmail> tag.
> Does anyone have an example, or a pointer to an example?
> BTW: for anyone out there who has not converted, or is contemplating 
> conversion, to Page Templates I can say that it is much less of a 
> learning curve than when I started with dtml. We're also discovering a 
> number of benefits to the conversion as well.
> If anyone is interested, I can post a synopsis of my experience with the 
> conversion from dtml to zpt.
> As I said.. so far the only outstanding issue for me is the 
> dtml-sendmail tag.

Because they don't fit ZPTs requirements (well-formed XML/HTML),
mail messages are actually one of the things we use DTML for
"normatively" (others are generating CSS and JavaScript).  We
changed the mechanism by which the DTML is called, however;  rather
than making it the top-level page, we call it via an intervening
page template or Python script.  For example, look at the "password
reminder" mechanism in CMFDefault:

   - The "I forgot my password" link takes you to a form, 'password_form',
     generated via ZPT;

   - The "target" page of that form is a PythonScript, 'mail_password';
     this script just calls the 'mail_password' method of the registration

   - The tool's method looks up the information for the user, and
     then calls a DTMLMethod;  finally, it returns a ZPT confirmation
     page, 'mail_password_response'.

   - The DTMLMethod, 'mail_password_template', formats and sends the
     mail;  it has *no* UI impact at all.
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com