[Zope] __replaceable__ doesn't make total sense

Chris Withers chrisw@nipltd.com
Wed, 19 Mar 2003 16:46:33 +0000


pieter claassen wrote:
> 1. Why is there no method.__replaceable__(why the concatenation?)

Method objects in python can't have arbitary attributes.

> 2. Where is this behaviour documented in Zope.

There's a project on the Fishbowl, IIRC.

> While we are on the topic, I still have not succeeded at doing something
> very simple. All I want to do is to include the result of a rendered
> object in another object so that I can produce content somewhere in my
> zope tree(this content might inherit some other content from higher in
> the tree) and then include that content in a display somewhere else (in
> a place where the original content cannot be acquired).
> 
> file1
> <dtml-var standard_html_header>
> <dtml-var menu> This var is aquired from my parent
> <dtml-var standard _html_footer>
> 
> file2
> <dtml-var standard_html_header>
> <dtml-var expr="/path/top/file1/file1.index_html()">This file is not in
> my acquisition tree and I just rendered its output for your convenience
> wrapped in a new header and footer!
> <dtml-var standard _html_footer>

You can do the above with two page templates ;-)

file1

<html metal:use-macro="here/main_template/>

file2

<html metal:use-macro="here/main_template>
<body>
<tal:x tal:replace="root/path/top/file1/file1.index_html"/>
</body>
</html>

> At the moment, I get a key-error telling me that file1 cannot find the
> <dtml-var menu> item so clearly it is not acquiring from its own tree.

DTML is evil. Don't use it.

cheers,

Chris