Skip to content
Snippets Groups Projects
Commit 6c4e328b authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

[SQLiteBaseDatabase] Make the instances picklable

parent 803f0e77
No related branches found
Tags v1.0.0
1 merge request!43[SQLiteBaseDatabase] Make the instances picklable
Pipeline #45998 passed
......@@ -199,6 +199,16 @@ class SQLiteBaseDatabase(object):
assert issubclass(file_class, File)
self.m_file_class = file_class
def __getstate__(self):
state = self.__dict__.copy()
state["m_session"] = None
return state
def __setstate__(self, state):
self.__dict__.update(state)
if os.path.exists(self.m_sqlite_file):
self.m_session = utils.session_try_readonly('sqlite', self.m_sqlite_file)
def __del__(self):
"""Closes the connection to the database."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment