[Zope-dev] Overriding __getattr__ for requests only.

Jeff K. Hoffman jkhoffman@carolina.rr.com
Fri, 12 Nov 1999 16:14:34 -0500 (EST)


On Fri, 12 Nov 1999, Christopher Petrilli wrote:

> On 11/12/99 3:57 PM, Jeff K. Hoffman at jkhoffman@carolina.rr.com wrote:
> 
> > I am trying to write a new subclass of OFS.Folder (as a python product) to
> > do the following: When a user requests /myFolder/index_html, myFolder
> > will search itself, then its list of 'parents', returning the attribute
> > from one of them if they have it, and raising an AttributeError if not.
> 
> Pardon my ignorance, but what exactly does this accomplish that isn't
> accomplished by Acquisition?

I am trying to build a site as follows:

---
/
  baseline/
    index_html
    content/
      paragraph_a
      paragraph_b
    images/
      image_a
      image_b
    variant1/
      content/
        paragraph_a
      images/
        image_b
    variant2/
      content/
        paragraph_b
      images/
        image_a
---

Such that navigating to /baseline/index_html shows paragraph_a,
paragraph_b, image_a, and image_b. I also need to be able to navigate to
/baseline/variant1 and see the same index_html, this time referencing the
"overloaded" paragraph_a and image_b. The same for variant2, with
paragraph_b and image_a.

I have found no obvious way to do this, using acquisition, without
flatting my folder hierarchy out as such:

---
/
  baseline/
    paragraph_a
    paragraph_b
    image_a
    image_b
    variant1/
      paragraph_a
      image_b
    variant2/
      paragraph_b
      image_a
---

This is unacceptable, because there are a LOT of paragraph's and images,
and I want to divide them up logically using folders.

I am evaluating Zope in the hopes of transitioning one of our major web
assets (which is currently built on top of our proprietary web development
platform, which supports inheritance) to Zope and dropping development on
our platform. I am finding it hard to move from an inheritance based model
to a purely acquisition based model without making major sacrifices in the
design of our site.

Am I stupid? Please tell me I'm missing something obvious.

> Chris

--Jeff