"Jeff K. Hoffman" wrote:
> Therefore, when index_html looks for header, the content folder is
> searched, then the home folder, then the lowres folder, then the home
> folder. Unfortunately, for our example, the header is found in the search
> of the home folder, and we never make it to the lowres folder.

Oops--thanks for pointing that out.  I sometimes wonder, however, why
it was set up this way.  Except for speed concerns, I see no reason
why, if we set up the algorithm a different way, it couldn't search
from right to left.  A simple approach would be like this:

def findattr(obj, name):
  while (obj is not None):
    base = getattr(obj, 'aq_base', obj)
    if hasattr(base, name):
      return getattr(obj, name)
    obj = getattr(obj, 'aq_parent', None)
  raise AttributeError, name

> Hope this makes sense. Acquisition is not one of the things I have become
> good at explaining, yet. The slides from Jim's Acquisition Algebra talk is
> about the best source of information on this subject.

Of course, Jim would probably look at my example and want to hit me. 
He likes things to be optimized.  :-)

Shane

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to