[Zope-CMF] need to link one folder from another

Dieter Maurer dieter@handshake.de
Sat, 19 Apr 2003 10:10:09 +0200


Dieter Maurer wrote at 2003-4-17 19:57 +0200:
 > ... "Reference" not working as skin name source ...
 >  ....
 >  >  > And the skin folders/references are definately not getting picked up by
 >  >  > portal_skins.
 >  > 
 >  > They do in my test.
 > 
 > Sorry, I was wrong!
 > I made a mistake in my test.
 > 
 > I will investigate why the reference does not work as expected.

I have bad news:

  A "Reference" will not work correctly as name source for a skin.


The reason is given by the comment to the "Reference.__of__" method:

        # DM: Acquisition is a really interesting thing!
        #     when "__of__" is called for the first time, "parent" is
        #     still unwrapped and "restrictedTraverse" will fail
        #     therefore, we check for it and return "self" in this case
        #     Usually, we will be called a second time, and this time
        #     "parent" is wrapped and we return the result.


  A "SkinsContainer" (such as "portal_skins") does not follow
  the usual pattern for "__of__" calling.

  When a reference is the last part in the skin path, both calls to "__of__"
  are with unwrapped parent objects and the reference cannot find
  its target.

  When the reference is not the last path, the second call of "__of__"
  is wrapped but the acquisition context is cut at the
  skins container. Therefore, the "restrictedTraverse" will
  fail unless the reference points to an object below this
  skins container.

There is nothing, "Reference" could do to work around this problem.


Dieter