Reputation: 229561
If I load an object which has several PersistentList attributes - are the lists automatically loaded in their entirety? Or does ZODB wait until I access an element of the list to load it? If the latter, does it load the entire list whenever an element is accessed, or only part of the list?
Upvotes: 4
Views: 332
Reputation: 1124718
Provided your elements inside the list are themselves inheriting from persistent.Persistent
, they will be loaded on demand.
Primitive types and classes that do not inherit from Persistent
, however, are loaded into memory together with the PersistentList instance.
PersistentList is basically a subclass of UserList
(and Persistent
) that sets self._p_changed
when altered, so that changes to the list are translated into a ZODB commit for it's record.
Upvotes: 4