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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top