[Zope3-Users] Syncing two attributes

Florian Lindner mailinglists at xgm.de
Fri Jun 24 15:36:02 EDT 2005


Hello,
I've one attribute A which is exposed via the Interface. Another internal 
attribute B should be in sync with it. So everytime A changes I want a 
function to be called. 

I think (solving another error stands before testing it) with __setattr__:

    def __setattr__(self, name, value):
        if name == "expirationTime":
            self.expTimeDelta = datetime.timedelta(minutes = value)
        
        self.__dict__[name] = value

But I really don't like that way? Is there elegant, more zope-like solution? 
Or is this the way to do it?

Thanks,

Florian


More information about the Zope3-users mailing list