Chris Withers wrote:

<snip last idea>

At Steve Alexander's suggestion, I'm going to try subclassing DataBlob
from PersistentMapping.
So now I need to add attribute support...

How do the following three methods sound:

def __getattr__(self,name):
        try:
                return PersistentMapping.__getattr__(self,name)
        except AttributeError,e:
                try:
                        return self.__getitem__(name)
                except KeyError:
                        raise AttributeError, e

def __setattr__(self,name,value):
        self.__setitem__(self,name,value)

def __delattr__(self,name):
        try:
                self.__delitem__(self,name)
        except KeyError,e:
                raise AttributeError,e

Can anyone see any problems?

cheers,

Chris

_______________________________________________
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