Commit 92a1f1b4 authored by Chris McDonough's avatar Chris McDonough

Merge from 2.7 branch:

Ensure that persistence machinery is tickled when __setitem__, __delitem__,
clear, and update are called on a transient object.

Also, use a distinct logger for error logging.
parent 1f2a7cce
......@@ -26,10 +26,11 @@ from Products.Transience.TransienceInterfaces import ItemWithId, Transient, \
from AccessControl import ClassSecurityInfo
import Globals
import logging
import sys
from ZODB.POSException import ConflictError
DEBUG = int(os.environ.get('Z_TOC_DEBUG', 0))
LOG = logging.getLogger('Zope.Transience')
LOG = logging.getLogger('Zope.TransientObject')
def TLOG(*args):
sargs = []
......@@ -149,10 +150,12 @@ class TransientObject(Persistent, Implicit):
return 0
def clear(self):
self._p_changed = 1
self._container.clear()
self.setLastModified()
def update(self, d):
self._p_changed = 1
for k in d.keys():
self[k] = d[k]
......@@ -161,6 +164,7 @@ class TransientObject(Persistent, Implicit):
#
def __setitem__(self, k, v):
self._p_changed = 1
self._container[k] = v
self.setLastModified()
......@@ -168,6 +172,7 @@ class TransientObject(Persistent, Implicit):
return self._container[k]
def __delitem__(self, k):
self._p_changed = 1
del self._container[k]
self.setLastModified()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment