[Zope] Diary of a wannabe ZOPISTA - Day 4
Jethro Cramp
jsc@zoo.co.uk
Thu, 8 Feb 2001 11:00:13 +0800
Hello All, this is my debut on this list. From watching it for the last
couple of days it seems to be a very active community.
I've spent the last 3 days immersed in ZOPE and ZOPE documentation, last
night my dreams were full of ZOPE objects interatcting with one another.
Whilst reading ZCMG and following along with the examples I came across
something that is either a mistake or completely throws into question
everything that I thought I had learnt about acquisition. The example occurs
in the Chapter "Zope Applications and Products" in the first section
"Creating Zope Applications using DTML scripts".
Home the example is available online at:
http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.4.1.html
In the example 'Stan' has made the following directory structure
root
|_ZAcme
|_Products
|
|_Research
|
|_News
In the Products folder he creates a DTML Method, index_html which is as
follows:
<dtml-var standard_html_header>
<dtml-var logo>
<H2><dtml-var company_name></H2>
<dtml-var message>
<HR>
For more information, contact us at <em>
<dtml-var contact_phone></em>
<dtml-var standard_html_footer>
All simple stuff. The method uses 5 properties on top of the standard header
and footer which are defined in the root folder.
In the example Stan goes on to create a folder 'Home' which is a sub-folder
of 'Products'
root
|_ZAcme
|_Products
| |_Home
|
|
|_Research
|
|_News
'Stan' then gives the 'Home' folder the 5 properties that are required by
the index_html DTML method. In the example acquisition takes care of this
and the DTML method works.
When I code it, it doesn't work. Moreover this upsets my (primitive)
understanding of acquistion which is that the index_html can only acquire
properties from objects 'up-stream' in the path. As soon as I move the
index_html page into the 'Home' folder everything works.
The problem is that the file index_html accesses properties of a folder that
is in the same level of the path as itself. My (primitive) understanding of
acquistion says that the index_html can only acquire properties from objects
'up-stream' in the path. This is born out by the example not working for me
when I try it as described. As soon as I move the index_html page into the
'Home' folder everything works. Shouldn't the properties belong the
'Products' folder?
Or is it that I have misunderstood the example and typed something wrong?
As a separate question. I keep repeating to myself "It's all about objects.
Objects have sub-objects, properties and methods". Every now and then I have
an epiphany and the clouds clear and I get a glimpse of the grand design
that is ZOPE and I feel that I get a step closer to being productive in
ZOPE. One of the first of these was realising that DTML methods are exactly
that: METHODS of the folder that they belong to. In that case in OOP terms
what are DTML documents to the folder that they reside in? Are they
properties of the folder?
TIA
Jethro