Skip to content
Snippets Groups Projects
Commit 2f2b60b6 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch 'sqlite-picklable' into 'master'

[SQLiteBaseDatabase] Make the instances picklable

See merge request !43
parents 803f0e77 6c4e328b
No related branches found
No related tags found
1 merge request!43[SQLiteBaseDatabase] Make the instances picklable
Pipeline #46010 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