Harald Wolff 2018-03-12 09:27:16 +01:00
commit 13bf9c6ad3
2 changed files with 12 additions and 4 deletions

View File

@ -121,6 +121,9 @@ class AquisitionProxy:
return v
def __setattr__(self,name,value):
if name == "":
raise AttributeError("attributes need to have a name!")
setattr( object.__getattribute__( self, "_o"), name, value )
def __delattr__(self,name):

View File

@ -30,12 +30,14 @@ def obj_getstate(o):
state["pfields"] = {}
state["pvalues"] = {}
nopersistence = getattr(o,"NOPERSIST",())
d = object.__getattribute__(o, "__dict__")
for n in d.keys():
a = getattr( o, n )
if (not isinstance( a, collections.Callable)) or isinstance( a, object ):
if (isinstance( a, NoPersistence)):
if (isinstance( a, NoPersistence)) or (n in nopersistence):
state["fields"][n] = None
elif (isinstance( a, Persistence)):
state["pvalues"][n] = a
@ -78,9 +80,12 @@ class ObjectBroker:
for n in list( self.__unsaved.keys() ):
s = self.__unsaved[n]
s["pvalues"] = None
self.__store[ s["pid"] ] = pickle.dumps(s)
del self.__unsaved[n]
try:
self.__store[ s["pid"] ] = pickle.dumps(s)
del self.__unsaved[n]
except AttributeError as ae:
log("AttributeError while storing object: %s" % (s,))
return state["pid"]
def load(self,persistence_id):