How to use the persistent.Persistent.__init__ function in persistent

To help you get started, we’ve selected a few persistent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zopefoundation / Zope / lib / python / persistent / dict.py View on Github external
subclassed.
    """

    # IterableUserDict provides all of the mapping behavior.  The
    # PersistentDict class is responsible marking the persistent
    # state as changed when a method actually changes the state.  At
    # the mapping API evolves, we may need to add more methods here.

    __super_delitem = IterableUserDict.__delitem__
    __super_setitem = IterableUserDict.__setitem__
    __super_clear = IterableUserDict.clear
    __super_update = IterableUserDict.update
    __super_setdefault = IterableUserDict.setdefault
    __super_popitem = IterableUserDict.popitem

    __super_p_init = persistent.Persistent.__init__
    __super_init = IterableUserDict.__init__

    def __init__(self, dict=None):
        self.__super_init(dict)
        self.__super_p_init()

    def __delitem__(self, key):
        self.__super_delitem(key)
        self._p_changed = True

    def __setitem__(self, key, v):
        self.__super_setitem(key, v)
        self._p_changed = True

    def clear(self):
        self.__super_clear()
github Pylons / pyramid_cookbook / docs / traversal_tutorial / zodb / tutorial / resources.py View on Github external
def __init__(self, title):
        Persistent.__init__(self)
        self.title = title
github indico / indico / indico / MaKaC / plugins / InstantMessaging / chatroom.py View on Github external
def __init__( self, name, owner, conference, modificationDate=None, createdInLocalServer=True, showRoom=False ):
        Persistent.__init__(self)
        self._name = name
        self._owner = owner
        self._creationDate = nowutc()
        self._conferences = PersistentMapping()
        self._conferences[conference.getId()] = conference
        self._modificationDate = modificationDate
        self._createdInLocalServer = createdInLocalServer
        self._showRoom = showRoom
        #the id will be assigned just before being stored in the DB.
        #If we try to create a counter now it will fail if it's the first chatroom
        #in the conference, since no indexes have been created yet
        self._id = None