External methods, DocumentTemplate and EPSF
Hello all! I have some questions conserning external methods... First: In an external method ( def ex_meth(self) ) self is reffering to the folder object containing the method that actually does the call? (this is how I understand the documentation) - how can I access the variables in the calling methods namespace? Second: I use three different DTML methods (contents, navbar and links) to make up the backbone of my pages, all three are called from one main setup method (main). Main is aqusitioned by the different folders, the rest of the methods are spesial to each folder. Question is - how can I access these methods from an external method and add and use them in external python string format (EPSF) so that the return from the external method will display a page with the normal backbone build? Third: How can I pass variables made in an external method back to the calling method so that it'll be available there? Help is much appreciated. Sture Lygren
On Wed, 5 May 1999 raver@box.dust.za.net wrote:
Hello all!
I have some questions conserning external methods...
First: In an external method ( def ex_meth(self) ) self is reffering to the folder object containing the method that actually does the call? (this is how I understand the documentation)
Yes - but remember there is a distinction between DTML Methods and DTML Documents. - how can I access the variables in the
calling methods namespace?
normal python convention: self.title self.navbar etc
Third: How can I pass variables made in an external method back to the calling method so that it'll be available there?
just 'return' the variables. For instance: def test(self): return [1,2,3] <!--# in test --> ... <!--#/in--> I am not sure I inderstand your second question. Pavlos
On Wed, May 05, 1999 at 12:46:25PM -0400, Pavlos Christoforou wrote:
On Wed, 5 May 1999 raver@box.dust.za.net wrote:
I am not sure I inderstand your second question.
Pavlos
At least U cleared out my problems on first and third question. Thanks! I'll try to clear up on the second question: I have one setup method (DTML one) in my top level folder, cut down version shown below: <!-- Make links--> <!--#var "_[l]"--> <!--Make navbar--> <!--#var navbar--> <!--#Display main content--> <!--#var "_[c]"--> Most of my folders contain the two DTML methods (links and contents) and my index_html is like: <!--#var standard_html_header--> <!--#with "_.namespace(l='links', c='contents)"--> <!--#var setup--> <!--#/with--> <!--#var standard_html_header--> In special cases where I need to use the same setup, but have the content be another file than 'contents' (say new_content) I do: ... <!--#with "_.namespace(l='links', c='new_content)"--> ... This is all good when I do it from within Zope, but I want an external method to be able to produce a page the same way, using the EPSF. I need my method to be able to access: standard_html_header, setup and standard_html_footer (sometimes also links and contents). Trying to access any with self (like self.setup) gives an error. Probably because these aren't contained in the calling folder, but aqusitioned from folders lower down?? So finally my question is: How do I get to the above mentioned DTML methods from within an external method? Sture
participants (2)
-
Pavlos Christoforou -
raver@box.dust.za.net