yet another adjustment to ListAdapter...

class ListAdapter(object):
     def __init__(self, parent, key):
         self.__parent = parent
         self.__key = key

     def __cached(self):
         try:
             return self.__cached_data
         except AttributeError:
             self.__cached_data = [item.data for item in  
self.__parent._data if item.key == self.__key]
             return self.__cached_data
     __cached = property(__cached)

     def __delcached(self):
         try:
             del self.__cached_data
         except AttributeError:
             pass

     def __iter__(self):
         return iter(self.__cached)

     def __eq__(self, other):
         return list(self) == list(other)

     def __repr__(self):
         return repr(list(self))

     def append(self, item):
         self.__delcached()
         self.__parent._data.append(DictOfListElement(self.__key, item))

     def __getitem__(self, index):
         return self.__cached[index]

     def __setitem__(self, index, value):
        self.__delcached()
         [item for item in self.__parent._data if item.key ==  
self.__key][index].data = value

     # other list like methods



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to