Several __getstate__ methods

Discussion in 'Python' started by Thomas =?ISO-8859-15?Q?G=FCttler?=, Jul 7, 2003.

  1. 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
     
    Thomas =?ISO-8859-15?Q?G=FCttler?=, Jul 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Sakkis

    set.__getstate__ not overriden

    George Sakkis, Oct 10, 2005, in forum: Python
    Replies:
    0
    Views:
    298
    George Sakkis
    Oct 10, 2005
  2. jelle
    Replies:
    6
    Views:
    286
  3. Iván Vega Rivera
    Replies:
    6
    Views:
    136
    Iván Vega Rivera
    Mar 8, 2006
  4. Victor \Zverok\ Shepelev

    RDOC: several related modules in several C files

    Victor \Zverok\ Shepelev, Mar 6, 2007, in forum: Ruby
    Replies:
    3
    Views:
    197
    Max Lapshin
    Mar 16, 2007
  5. Kenneth McDonald
    Replies:
    5
    Views:
    373
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page