Exemplo n.º 1
0
 def listItems(self):
     # Now this is tricky: we want to construct a small object graph using
     # old state pickles without ever calling __setstate__ on a real
     # Persistent object, as _that_ would poison ZODB in-memory caches
     # in a nasty way (LP #487243).
     container = OrderedContainer()
     container.__setstate__(self.state)
     if isinstance(container._data, PersistentDict):
         old_data_state = IObjectHistory(container._data).loadState(self.tid)
         container._data = PersistentDict()
         container._data.__setstate__(old_data_state)
     if isinstance(container._order, PersistentList):
         old_order_state = IObjectHistory(container._order).loadState(self.tid)
         container._order = PersistentList()
         container._order.__setstate__(old_order_state)
     return container.items()
Exemplo n.º 2
0
 def listItems(self):
     # Now this is tricky: we want to construct a small object graph using
     # old state pickles without ever calling __setstate__ on a real
     # Persistent object, as _that_ would poison ZODB in-memory caches
     # in a nasty way (LP #487243).
     container = OrderedContainer()
     container.__setstate__(self.state)
     if isinstance(container._data, PersistentDict):
         old_data_state = IObjectHistory(container._data).loadState(
             self.tid)
         container._data = PersistentDict()
         container._data.__setstate__(old_data_state)
     if isinstance(container._order, PersistentList):
         old_order_state = IObjectHistory(container._order).loadState(
             self.tid)
         container._order = PersistentList()
         container._order.__setstate__(old_order_state)
     return container.items()