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

Carl Rendell cer@sol43.com
Sat, 20 Apr 2002 09:52:06 -0700


On Saturday, April 20, 2002, at 09:00  AM, zope-cmf-
request@zope.org wrote:

> Subject: Re: [Zope-CMF] dtml-sendmail equiv in page templates?
>
> 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
>      tool;
>
>    - 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.
>

That's interesting, and also reiterates comments about the 
coexistence of ztp and dtml.

We're also using dtml for non template kinds of output like CSS and 
JavaScript, but had yet to put email in that category. Makes 
perfect sense though. It would seem a rule of sorts could be 
applied when doing development -

o well formed, structured (HTML,XML, and XML derivatives) = Page 
Templates
o not well formed or structured (mail, CSS, JavasScript, structured 
text, etc) = DTML

Sounds like another piece to the DTML to ZPT conversion 
article/reference.

Thanks

Carl E. Rendell
Solution43
Information Distribution Consulting        |   "Ahhhh the power of
cer@sol43.com                              |    acquisition"  - Chef Z