[Zope] Acqusition and External Methods...

Phillip J. Eby pje@telecommunity.com
Sat, 07 Aug 1999 09:04:32 -0500


At 07:11 AM 8/7/99 +0100, Tony.McDonald@newcastle.ac.uk wrote:
>> 
>> 	I got the same error when doing something similar.  I don't think you 
>> can say 'in "function"'  Store the function to a variable first and then
say 'in 
>> variable'.
>> 	Donner
>> 
>Cheers for the thoughts Donald,
>I did this:
>import DocumentTemplate
>from Acquisition import Implicit
>
>def doit(self):
>        template_str = str(self.modulecontributor)
>        template_str2 = '''<table>
><tr><td bgcolor=silver colspan=2>This data is being dynamically generated
from a database</td></tr>
>
><dtml-let result="info_from_email(email=content)">
><dtml-in result>
><tr><td><dtml-var Title> <dtml-var Surname></td></tr>
></dtml-in>
></dtml-let>
></table>'''
>
>        template = DocumentTemplate.HTML(template_str2
>)
>        return template(content='hirst')

Try:

return template(self,content='hirst')

Right now, your DocumentTemplate has nowhere to get info_from_email *from*.

Also, btw, <!--#in "function()"--> is perfectly valid, I do it all the
time.  However, in a case where an ExternalMethod needs a 'self', you may
have to call it as:

<!--#in "function(name_of_folder_to_be_used_as_self)"-->

This was true in older versions of Zope, anyway, I don't know what the
current state of things is.