Class
ZODB.broken.PersistentBroken

Persistent broken objects

Persistent broken objects are used for broken objects that are also persistent. In addition to having to track the original object data, they need to handle persistent meta data.

Persistent broken classes are created from existing broken classes using the persistentBroken, function:

   >>> Atall = type('Atall', (Broken, ), {'__module__': 'not.there'})
   >>> PAtall = persistentBroken(Atall)

(Note that we always get the same persistent broken class for a given broken class:

   >>> persistentBroken(Atall) is PAtall
   True

  )

Persistent broken classes work a lot like broken classes:

   >>> a = PAtall.__new__(PAtall, 1, 2)
   >>> a
   <persistent broken not.there.Atall instance None>
   >>> a.__Broken_newargs__
   (1, 2)
   >>> a.__Broken_initargs__
   >>> a.x = 1
   Traceback (most recent call last):
   ...
   BrokenModified: Can't change broken objects

Unlike regular broken objects, persistent broken objects keep track of persistence meta data:

>>> a._p_oid = \0\0\0\0**** >>> a

and persistent broken objects aren't directly picklable:

>>> a.__reduce__() # doctest: +NORMALIZE_WHITESPACE Traceback (most recent call last): ... BrokenModified:

but you can get their state:

>>> a.__setstate__({'y': 2}) >>> a.__getstate__() {'y': 2}

Cleanup:

  >>> broken_cache.clear()

Base classes

Implemented Interfaces

Attributes/Properties

There are no attributes in this class.

Methods

There are no methods in this class.

Known Subclasses

There are no known subclasses.