Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
dbpickle.DBUnpickler Class Reference

List of all members.

Public Member Functions

def __init__
def persistent_load

Public Attributes


Detailed Description

Definition at line 26 of file

Constructor & Destructor Documentation

def dbpickle.DBUnpickler.__init__ (   self,

Definition at line 28 of file

00029     def __init__(self, file, connection):
00030         super().__init__(file)
00031         self.connection = connection

Here is the caller graph for this function:

Member Function Documentation

def dbpickle.DBUnpickler.persistent_load (   self,

Definition at line 32 of file

00033     def persistent_load(self, pid):
00034         # This method is invoked whenever a persistent ID is encountered.
00035         # Here, pid is the tuple returned by DBPickler.
00036         cursor = self.connection.cursor()
00037         type_tag, key_id = pid
00038         if type_tag == "MemoRecord":
00039             # Fetch the referenced record from the database and return it.
00040             cursor.execute("SELECT * FROM memos WHERE key=?", (str(key_id),))
00041             key, task = cursor.fetchone()
00042             return MemoRecord(key, task)
00043         else:
00044             # Always raises an error if you cannot return the correct object.
00045             # Otherwise, the unpickler will think None is the object referenced
00046             # by the persistent ID.
00047             raise pickle.UnpicklingError("unsupported persistent object")

Here is the caller graph for this function:

Member Data Documentation

Definition at line 30 of file

The documentation for this class was generated from the following file: