Commit f4be63cc authored by Jim Fulton's avatar Jim Fulton

Fixed missfeature pointed out by PJE. We do not quite provide

transparent Pythonic sematics for __setattr__ and __delattr__.
If these methods are implemented, then they *must*::

  self._p_changed=1 # prefered

or::

  self.__changed__(1) # if people get the heebe-jeebees from setting attrs

to manually register that an object's persistent state has changed, if,
in fact, it has.
parent ae515beb
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file. attributions are listed in the accompanying credits file.
****************************************************************************/ ****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.37 2000/05/16 17:31:58 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.38 2000/05/30 17:27:43 jim Exp $";
#include <string.h> #include <string.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -650,8 +650,10 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v, ...@@ -650,8 +650,10 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
/* Record access times */ /* Record access times */
self->atime=((long)(time(NULL)/3))%65536; self->atime=((long)(time(NULL)/3))%65536;
if(! (*name=='_' && name[1]=='v' && name[2]=='_') if((! (*name=='_' && name[1]=='v' && name[2]=='_'))
&& self->state != cPersistent_CHANGED_STATE && self->jar) && (self->state != cPersistent_CHANGED_STATE && self->jar)
&& setattrf
)
if(changed(self) < 0) return -1; if(changed(self) < 0) return -1;
} }
...@@ -783,7 +785,7 @@ void ...@@ -783,7 +785,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.37 $"; char *rev="$Revision: 1.38 $";
TimeStamp=PyString_FromString("TimeStamp"); TimeStamp=PyString_FromString("TimeStamp");
if (! TimeStamp) return; if (! TimeStamp) return;
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file. attributions are listed in the accompanying credits file.
****************************************************************************/ ****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.37 2000/05/16 17:31:58 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.38 2000/05/30 17:27:43 jim Exp $";
#include <string.h> #include <string.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -650,8 +650,10 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v, ...@@ -650,8 +650,10 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
/* Record access times */ /* Record access times */
self->atime=((long)(time(NULL)/3))%65536; self->atime=((long)(time(NULL)/3))%65536;
if(! (*name=='_' && name[1]=='v' && name[2]=='_') if((! (*name=='_' && name[1]=='v' && name[2]=='_'))
&& self->state != cPersistent_CHANGED_STATE && self->jar) && (self->state != cPersistent_CHANGED_STATE && self->jar)
&& setattrf
)
if(changed(self) < 0) return -1; if(changed(self) < 0) return -1;
} }
...@@ -783,7 +785,7 @@ void ...@@ -783,7 +785,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.37 $"; char *rev="$Revision: 1.38 $";
TimeStamp=PyString_FromString("TimeStamp"); TimeStamp=PyString_FromString("TimeStamp");
if (! TimeStamp) return; if (! TimeStamp) return;
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file. attributions are listed in the accompanying credits file.
****************************************************************************/ ****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.37 2000/05/16 17:31:58 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.38 2000/05/30 17:27:43 jim Exp $";
#include <string.h> #include <string.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -650,8 +650,10 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v, ...@@ -650,8 +650,10 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
/* Record access times */ /* Record access times */
self->atime=((long)(time(NULL)/3))%65536; self->atime=((long)(time(NULL)/3))%65536;
if(! (*name=='_' && name[1]=='v' && name[2]=='_') if((! (*name=='_' && name[1]=='v' && name[2]=='_'))
&& self->state != cPersistent_CHANGED_STATE && self->jar) && (self->state != cPersistent_CHANGED_STATE && self->jar)
&& setattrf
)
if(changed(self) < 0) return -1; if(changed(self) < 0) return -1;
} }
...@@ -783,7 +785,7 @@ void ...@@ -783,7 +785,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.37 $"; char *rev="$Revision: 1.38 $";
TimeStamp=PyString_FromString("TimeStamp"); TimeStamp=PyString_FromString("TimeStamp");
if (! TimeStamp) return; if (! TimeStamp) return;
......
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