[Zope] Site navigation
Michael Long
mlong at datalong.com
Fri Sep 26 09:56:17 EDT 2003
> You're setting the attribute of a _class_ in a method. Go ask on
> comp.lang.python why that's bad, but, the quick answer is just DON'T
DO IT!
I still don't understand but will research it some more. :(
> >>> if REQUEST is not None:
> >>> return self.Template_index_html(self, REQUEST)
> >>
> >>Where does Template_index_html come from?
> >
> Urm, I don't think you've given the whole story there. How does it end
up in self?
>
I am writing a product and borrowed this technique from the JTracker
product http://zope.org/Members/jens/Folder.2003-08-11.1400/JTracker.
Basically I have a file "Template_Site.pt" which defines a macro.
Another file "Template_index_html.pt" that uses that macro.
I then define these attributes within the class:
Template_Site=PageTemplateFile('Template_Site.pt', _wwwdir)
Template_index_html=PageTemplateFile('Template_index_html.pt', _wwwdir)
Within Template_index_html.pt the following is defined:
<div id="content_main" metal:fill-slot="content_main">
<span tal:replace="structure here/Content_Main|nothing">
Main Content
</span>
</div>
The python method within the class then redifines the attribute
Content_Main to define which file I want to pull my html from for the
main body of the page. Am I abusing my zpt?
> as a concept is very simple (hence why everyone loves it), the
implementation is
> often very complex... think about form submission, and one-way state
transitions...
So I have learned :)
More information about the Zope
mailing list