GEPS 017: Flexible gen.lib Interface
gen.lib is the Python interface for all of the objects in Gramps. Currently, it is not directly tied to any data storage mechanism, except for the implicit assumption that objects are created through an unserialize method for each object.
This proposal explores the possibility of making the creation of objects more general, and less tied to the particular unserializing process.
Currently, the main database interface for getting an object looks like:
This uses the only existing manner of creating a person supported by gen.lib:
where data is a serialized (non-object) representation of a Person.
This has two issues:
- it may unserialize data that isn't needed
- it only allows data to be created in this particular manner
This proposal would allow for an alternative gen.lib construction.
In the detailed mailing-list discussion , there were four possible solutions:
- If an alternative is needed, use something outside of gen.lib
- Using a lazy() wrapper to only evaluate what is necessary
- Use an Engine inside each object to retrieve data when necessary
- Explicit delayed unpickling