Re: [Zope-dev] Acquisition Filtered Folder stuff

2001-06-12 Thread Chris Withers

Dieter Maurer wrote:
 
 Chris Withers writes:
   Dieter Maurer wrote:
   
What you probably need:
   
  derive a new ObjectManager from Acquisition.Explicit and
  the current ObjectManager.
   
  provide an interface to manage the attributes that should
  be acquired implicitly.
  
   Well, I had a go at this, but not quite in the way you describe.
  
   I subclassed Folder and overrode __getattr_ with:
 This does not work because Python calls __getattr__ only,
 if it can not find the attribute through normal means.
 Due to the implementation of Acquisition, acquired attributes
 are found by normal means bypassing __getattr__.

Ah, that makes sense :-)

 You may be successful, if you override __of__.
 It is this method that (usually) builds the acquisition wrapper.

When does it not build the wrapper?

 You can try to build an explicit rather than implicit acquisition
 wrapper.

Yeah, I'll give it a go, once the problems below have been worked out...

 The easiest way, of course, is to derive the class from
 Acquisition.Explicit with higher priority (more to the left)
 than from Acquisition.Implicit.

Hmmm... then maybe use the acquire() method to get hold of names that can be
acquired, in the __getattr__ method?

There is a more fundamental problem here though; If you limit acquisition to a
specified list of names, what do you do about all the stuff Zope normally
silently acquires, like the security context, the REQUEST, etc?

It would be great if you could make it work along the lines of acquire all the
Zope internal stuff, but beyond that, only acquire if the name is in this list.
But how would we define all the Zope internal stuff and how would we implement
the logic? 

Hurm... this sounds like a problem of Fultonesque proportions :-S

cheers,

Chris

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



Re: [Zope-dev] Acquisition Filtered Folder stuff

2001-06-12 Thread Dieter Maurer

Chris Withers writes:
  Dieter Maurer wrote:
   You may be successful, if you override __of__.
   It is this method that (usually) builds the acquisition wrapper.
  
  When does it not build the wrapper?
If it is not the __of__ defined by Acquisition.{Im,Ex}plicit,
it may not build acquisition wrappers.
E.g. the __of__ of ComputedAttribute does not.

   The easiest way, of course, is to derive the class from
   Acquisition.Explicit with higher priority (more to the left)
   than from Acquisition.Implicit.
  
  Hmmm... then maybe use the acquire() method to get hold of names that can be
  acquired, in the __getattr__ method?
Read the Acquisition documentation:

   With explicit acquisition, you can declare that some attributes
   should be acquired implicitly.

Of course, you can do it in __getattr__, too.

  There is a more fundamental problem here though; If you limit acquisition to a
  specified list of names, what do you do about all the stuff Zope normally
  silently acquires, like the security context, the REQUEST, etc?
I expect, that the security context is explicitly acquired
(not sure).

For REQUEST and some essential other objects, you can declare
them to be implicitly acquired.

  It would be great if you could make it work along the lines of acquire all the
  Zope internal stuff, but beyond that, only acquire if the name is in this list.
  But how would we define all the Zope internal stuff and how would we implement
  the logic? 
The first question may have some surprises. The second should not be too
difficult.

  Hurm... this sounds like a problem of Fultonesque proportions :-S
Maybe, we wait a bit. As I heard, DC is thinking about making
acquisition explicit rathen than implicit.


Dieter

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