Not persistent on all classes please
I have a class in a product, which inherits from another product which in turn inherits from another product class. Consequently, I have inherited from the persistance class which makes object stick in the ZODB after you close it down. Now that's nice and all and there's not much I can do about it. But suppose that in this particular subclass I do NOT want the persistance base class. I don't want these objects to stick in the ZODB. Is that possible to cicumvent? I would like to do something like this: class Subsubsubclass(basecomponent, - persistance) Peter PS. All I know about persistance is that if you base class it, you automatically get persistent objects. How it happens, I don't know.
Peter Bengtsson wrote:
PS. All I know about persistance is that if you base class it, you automatically get persistent objects. How it happens, I don't know.
They only stay around if you store references to them anywhere... eg: x.b = a Now, if x is stored persistently (ie somewhere else you have y.b=x), then a will be too. Inheritence from the Persistent class doesn't haev that much to do with it to be honest ;-) cheers, Chris
PS. All I know about persistance is that if you base class it, you automatically get persistent objects. How it happens, I don't know.
They only stay around if you store references to them anywhere...
eg:
x.b = a
Now, if x is stored persistently (ie somewhere else you have y.b=x), then a will be too. Inheritence from the Persistent class doesn't haev that much to do with it to be honest ;-)
What I basically want it to do is to save File objects in a container. The class name I chose was "TempObjectHolder" for this subclass. the most important method it has is:: def saveTempFile(self,file): """ pseudo class. create a file, but the file must still be there when I restart Zope if possible """ self.manage_addFile(generatedId(),file)
Peter Bengtsson wrote:
What I basically want it to do is to save File objects in a container. The class name I chose was "TempObjectHolder" for this subclass. the most important method it has is::
def saveTempFile(self,file): """ pseudo class. create a file, but the file must still be there when I restart Zope if possible """ self.manage_addFile(generatedId(),file)
So you DO want persistence?! Huh?! You need to be a bit clearer about what the problem is that you're actually experiencing... cheers, Chris
def saveTempFile(self,file): """ pseudo class. create a file, but the file must still be there when I restart Zope if possible """ self.manage_addFile(generatedId(),file)
So you DO want persistence?!
Huh?!
You need to be a bit clearer about what the problem is that you're actually experiencing...
Now I'm very confused. When I once created a simple python product in a very different context, I forgot to base class persistance. What happened was that I could create little objects with icons and all, but when I restarted zope, the objects had disappered. As if somebody forgot to lock the gate and all the sheeps escaped during the night. The alternative is that we have a have a script that regularly "cleans" all objects flagged "picked" or something primitive. Is it clear at all?
participants (2)
-
Chris Withers -
Peter Bengtsson