[Zope] self=self.this() !!

Stefan H. Holek stefan@epy.co.at
Mon, 25 Jun 2001 15:17:20 +0200 (CEST)


Well, as I realised only yesterday, sometimes 'self' is not equal to
'this()' ;)

this() is defined by the Item baseclass and indeed looks like

def this():
    return self 

Not all objects are Items though, and for example when creating a
custom user folder, I had to put in its factory method (manage_addXYZ):

self.this().__allow_groups__ = mynewuserfolderobject

The reason is that, while in the factory method, self does not refer to 
an ObjectManager, but to a __FactoryDispatcher__ class. Using self.this()
will return the self *of the nearest Item subclass*; the desired 
ObjectManager in my case. Note that a call like self.this() is subject to
aquisition!

Regards,
Stefan


On Mon, 25 Jun 2001, Sedat Yilmazer wrote:

>  
>  What is the meaning
>  
>  self = self.this() 
>  
>  
> Sedat Yilmazer
> Kibele Iletisim Sis. ve Serv. Ltd.
>  
>