Thanks for the reply.

Oliver Bleutgen wrote:
> > def __getattr__(self,attr):
> >   if name = 'foo':
> >     return self.foo()
> >
> >   return Implicit.__class__.__getattr__(self,attr)
> If you really want to do just that, take a look at ComputedAttribute,
> just in case you don't know.
> foo = ComputedAttribute(_foo)
> def _foo(self,..):
>      <do something>
>      return something

I perhaps should have clarified that I need to be able to specify the
name of the attributes or methods at run time, so ComputedAttribute
unfortunately won't do the trick as you have to define each
attribute/method you require in the class definition.

ie. I need something like :
def __getattr__(self,attr):
   if name in self.methodlist:
     <do something>
   return Implicit.__class__.__getattr__(self,attr)

where self.methodlist is a list of strings that may change per instance
and/or at runtime, or itself could be calculated at the time of doing
the __getattr__ (eg self.getMethodList()).

One other way that may work is to be able to set methods on the object
as it comes out of the ZODB for use, as I need to be able to get methods
from other objects in the ZODB, something to explore... Anyone have any
pointers on this one perhaps?



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

Reply via email to