Hi, I am having trouble designing my classes.
I have two classes. The first one wraps around an old-style class called oref Class CacheClass(object): def __init__(self, obj): self.__data = obj def __getattr__(self, attr): return getattr(self.__data, attr) The second class is much the same, also wrapping, but has some attributes. class CacheProperty(object): def __init__(self, obj, dicProperties={}): self.__data = obj lisProperties=[] for key, val in dicProperties.iteritems(): setattr(self, key, val) lisProperties.append(key) self.Properties = lisProperties def __getattr__(self, attr): return getattr(self.__data, attr) Here is my code: >>> MyClass = CacheClass(oref) >>> MyProperty = CacheProperty(oref2,{'Name':'Surname', 'Value':'Peter'}) >>> setattr(MyClass,MyProperty.Name,MyProperty) Now, the problem is that I want a method MyClass.MyProperty.Save() to save the value of MyClass.MyProperty to the database backend on disk, but the code for this is part of the wrapped oref code, and thus is invoked only by MyClass.set(MyProperty.Name,MyProperty.Value). How can I access this method inside the MyProperty class? I hope this is clear! regard,s matthew -- http://mail.python.org/mailman/listinfo/python-list