mapping.py 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################

"""Python implementation of persistent base types

17
$Id$"""
18 19 20 21 22 23 24 25

import Persistence
import persistent
from persistent.mapping import PersistentMapping

if Persistence.Persistent is not persistent.Persistent:
    class PersistentMapping(Persistence.Persistent, PersistentMapping):
        """Legacy persistent mapping class
Tim Peters's avatar
Tim Peters committed
26

27
        This class mixes in ExtensionClass Base if it is present.
Tim Peters's avatar
Tim Peters committed
28

29 30 31
        Unless you actually want ExtensionClass semantics, use
        persistent.mapping.PersistentMapping instead.
        """
Tim Peters's avatar
Tim Peters committed
32

33 34 35 36 37
        def __setstate__(self, state):
            if 'data' not in state:
                state['data'] = state['_container']
                del state['_container']
            self.__dict__.update(state)