Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Several __getstate__ methods (http://www.velocityreviews.com/forums/t319344-several-__getstate__-methods.html)

Thomas =?ISO-8859-15?Q?G=FCttler?= 07-07-2003 01:06 PM

Several __getstate__ methods
 
Hi!

I use ZODB3. I want to pickle parts
of my database and import it on a different system.

Since, as far as I know, ZODB uses the __getstate__ method
for pickling the objects.

For my export, I want to ignore some parts of my objects.

If I will change __getstate__ I am in trouble because Zope
uses it.

Using a global variable in __getstate__ to see if I am in
"zope-getstate" or "my-export getstate" mode is dangerous, since
the application is multithreaded.

I thought about using a dict which holds the variable for each thread.

What other solutions are possible?


Example:

class MyClass:
def __init__(self, root)
self.root=root

I want to ignore the reference to root, since I want to import the
object into a new root.


thomas





All times are GMT. The time now is 12:47 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.