[Zope] sendmail and namespace

Tres Seaver tseaver@palladion.com
Fri, 21 Apr 2000 15:52:14 -0500


mindlace <mindlace@imeme.net>
> 
> Zopistas,
> 
> Why doesn't this work in a method?
> 
> <dtml-in "objectValues(['DTML Document'])"
> <dtml-sendmail smtphost="imeme.net">
> To: &dtml-title; <<dtml-var email>@imeme.net>
> From: imeme <admin@imeme.net>
> Subject: imeme
> <dtml-var body>
> </dtml-sendmail>
> </dtml-in>
> 
> It gets the values for title from the folder that contains the method,
> not from the DTML Document that's supposed to be on top of the
> namespace.
> 
> I tried
> <dtml-sendmail smtphost="imeme.net">
> <dtml-with "_['sequence-item']" only>
> To: &dtml-title; <<dtml-var email>@imeme.net>
> From: imeme <admin@imeme.net>
> Subject: imeme
> <dtml-var body>
> </dtml-with>
> </dtml-sendmail>
> 
> and that doesn't work either.

I put a bug in the Collector on this back in January:

  http://classic.zope.org:8080/Collector/995/view

The problem is that the sendmail tag pushes itself onto the top of the namespace
stack, and so values like 'id' and 'title' are handled in its acquisition
context, rather than your document.

A workaround is to alias the values you need before starting the sendmail tag::

 <dtml-in "objectValues(['DTML Document'])"
 <dtml-let docTitle=title>
 <dtml-sendmail smtphost="imeme.net">
 To: &dtml-docTitle; <<dtml-var email>@imeme.net>
 From: imeme <admin@imeme.net>
 Subject: imeme
 
 <dtml-var body>
 </dtml-sendmail>
 </dtml-let>
 </dtml-in>
  
Tres.
-- 
=========================================================
Tres Seaver  tseaver@digicool.com   tseaver@palladion.com