On Friday 07 June 2002 06:44 pm, Julien Jalon wrote:
Beautiful -- thanks a ton ~~

nic
> 
> import ExtensionClass
> import Acquisition
> 
> class Outer(ExtensionClass.Base):
> 
>     thing = ('help', 'donthelp')
> 
> class Inner_base(Acquisition.Implicit):
>     # here the real declaration of the class
> 
>     def aMethod(self):
>         print self.help
> 
> class Inner(Inner_base):
>     # here the class to use
> 
>     def __of__(self, parent):
>         real_object = Inner_wrapper()
>         real_object.__dict__['_parent'] = parent
>         real_object.__dict__['_inner'] = self
>         return real_object.__of__(parent) 
> 
> class Inner_wrapper(Inner_base):
> 
>     def __setattr__(self,name,value):
>         if name in self.__of__(self._parent).thing:
>             self.__dict__['_inner'].__dict__[name] = value
>         else:
>             print "Bad attribute"
> 
>     def __getattr__(self,name):
>         return getattr(self.__dict__['_inner'], name)
> 
> O = Outer()
> I = Inner()
> O.I = I
> 
> O.I.help = 'me rhonda'
> O.I.aMethod()
> I.aMethod()
> print I.__dict__
> print O.I.__dict__
> O.I.badattr = 'blah'
> 
> -- 
> Julien Jalon
> <http://nuxeo.com/>
> 
> 
> _______________________________________________
> 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 )
> 
> 



_______________________________________________
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 )

Reply via email to