Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Several __getstate__ methods

Thread Tools

Several __getstate__ methods

Thomas =?ISO-8859-15?Q?G=FCttler?=
Posts: n/a

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?


class MyClass:
def __init__(self, root)

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


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
group several methods under a attribute jelle Python 6 04-09-2009 01:06 PM
Is there a way to find the class methods of a class, just like'methods' finds the instance methods? Kenneth McDonald Ruby 5 09-26-2008 03:09 PM
RDOC: several related modules in several C files Victor \Zverok\ Shepelev Ruby 3 03-16-2007 04:15 PM
Passing the same argument(s) to several methods at once Iván Vega Rivera Ruby 6 03-08-2006 02:27 AM
set.__getstate__ not overriden George Sakkis Python 0 10-10-2005 05:47 PM