[Zope] Acqusition and External Methods...
Tony.McDonald@newcastle.ac.uk
Tony.McDonald@newcastle.ac.uk
Sun, 8 Aug 1999 10:00:29 +0100 (BST)
Phillip Eby said..
>
> 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.
>
>
Yes. At last. That's it. This works...
import DocumentTemplate
from Acquisition import Implicit
def dosearch(self):
template = self.search.read_raw()
completed = DocumentTemplate.HTML(template)
theresult = completed(self, content='a')
return(self, theresult)
Notes:
1) search is a DTML document that does a ZSQL query. This is the code that I want to modify (and ultimately, let others modify to their own specifications). This is *such* a big win for us...
2) In this snippet, content is defined in the Python code. In my real application it is obtained from a db lookup
3) the read_raw method is important, otherwise the template is HTML-quoted
4) Phillip is *the man*! :)
Many thanks Phillip, this has broken a huge log jam for me.
cheers again,
tone out.