[Zope] Re: states in _p_resolveConflicts

Florent Guillaume fg at nuxeo.com
Wed Dec 7 19:55:20 EST 2005


[Followup-To zodb-dev]

Dennis Allison wrote:
> I am having trouble understanding what they are and how one gets from 
> a "state" to the ZODB value associated with thast state.  Can someone 
> assist?

The state is whatever __getstate__ and __getstate__ manipulate. It has 
to be picklable. For persistent classes, an instance dict is the common 
case. persistent.Persistent.__getstate__ has this docstring:

"""
Get the object serialization state

If the object has no assigned slots and has no instance dictionary, then
None is returned.

If the object has no assigned slots and has an instance dictionary, then
the a copy of the instance dictionary is returned. The copy has any items
with names starting with '_v_' or '_p_' ommitted.

If the object has assigned slots, then a two-element tuple is returned.
The first element is either None or a copy of the instance dictionary,
as described above. The second element is a dictionary with items
for each of the assigned slots.
"""

Other classes can specialise the methods, see for instance BTrees.Length.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list