473,379 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

Jul 18 '05 #1
0 1900

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: D E | last post by:
What are some good methods of letting a user's "identity" (?session?) be known across several webpages. For example, a user logs in, and several pages say "Welcome back KNOWN USER" if he...
2
by: Jerry | last post by:
My "main" class is getting a bit long...Is it possble to split a class definition into several files and then import the pieces to get the whole definition? Jerry
0
by: George Sakkis | last post by:
>>> import pickle >>> class Foo(set): .... def __getstate__(self): assert False >>> pickle.dumps(Foo()) # doesn't raise AssertionError The same happens with frozenset. Before I submit it...
3
by: Wiktor Zychla | last post by:
I would like to be able to convert enums to their string representation but I would like to be able to apply a custom formatting, so that I could write for example: enum E { a, b, c }; string...
4
by: Malkocoglu | last post by:
In the good old days , i had a class that had 30 functions (let's say) There was a single include(*.H) file and i could have several implementation(*.CPP) files The reason for doing this is to...
7
by: Byron | last post by:
I have several user controls that have a few methods in common, such LoadFromForm() which populates an object from controls on the form. I want to call that method from the form in which the...
0
by: Vasco Lohrenscheit | last post by:
Hello, I have problems with pointers to unmanaged classes as parameters for virtual methods, and then overwriting the virtual methods in other assemblies: //GUI.dll #include...
9
by: eitan | last post by:
Hello, I am using Microsoft Visual Studio 2003 .NET. I have several question, please. 1) I have a connection to the database, which I create it at login, by application("conMain") (I have...
6
by: =?ISO-8859-1?Q?Une_B=E9vue?= | last post by:
i'd like to intercept the window.onload event in order to distribute it, as needed, to several methods. example : suppose i have several methods doing unlinked initialisations: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.