[Zope-Checkins] CVS: Zope3/lib/python/Persistence - _persistent.py:1.3 cPersistence.c:1.3
Jeremy Hylton
jeremy@zope.com
Fri, 21 Jun 2002 18:40:14 -0400
Update of /cvs-repository/Zope3/lib/python/Persistence
In directory cvs.zope.org:/tmp/cvs-serv13614
Modified Files:
_persistent.py cPersistence.c
Log Message:
Expose an explicit method for unghostification _p_activate().
=== Zope3/lib/python/Persistence/_persistent.py 1.2 => 1.3 ===
self._p_state = None
+ def _p_activate(self):
+ state = self._p_state
+ if state is None:
+ dm = self._p_jar
+ if dm is not None:
+ setstate(self, dm, 0)
+
def __getattribute__(self, name):
if name[:3] != '_p_' and name != '__dict__':
- state=self._p_state
- if state is None:
- dm=self._p_jar
- if dm is not None:
- setstate(self, dm, 0)
-
- object.__setattr__(self, '_p_atime', int(time() % 86400))
+ self._p_activate()
+ self._p_atime = int(time() % 86400)
return object.__getattribute__(self, name)
=== Zope3/lib/python/Persistence/cPersistence.c 1.2 => 1.3 ===
static PyMethodDef base_persist_methods[] = {
{"_p_deactivate", (PyCFunction)persist_deactivate, METH_NOARGS, },
+ {"_p_activate", (PyCFunction)_PyPersist_Load, METH_NOARGS, },
{NULL}
};
@@ -364,6 +365,7 @@
{"__getstate__", (PyCFunction)persist_getstate, METH_NOARGS, },
{"__setstate__", persist_setstate, METH_O, },
{"_p_deactivate", (PyCFunction)persist_deactivate, METH_NOARGS, },
+ {"_p_activate", (PyCFunction)_PyPersist_Load, METH_NOARGS, },
{NULL}
};