From: Nick H. <nic...@ho...> - 2013-12-29 18:45:37
|
On 27/12/13 23:47, Doug Blank wrote: >> The proposed changes save typing, but I don't see much of an advantage. > Yes, these two are only about saving typing. I think about how often I > type "_from_handle" and "_from_gramps_id" and how many more times I > will type them in the future.... But I think "get_person_from_id" and > just "get_person" are clear and consistent too, so all things being > equal, why not be efficient? If you want to be efficient then we should make a bigger change. Consider the following code: handle = family.get_father_handle() if handle: father = db.get_person_from_handle(handle) What we really want is: father = family.get_father() We could also tidy up some of the utility functions. For example: event.get_participants() would be nicer than: get_participant_from_event(db, event.handle) Why do we expose the database handle in the API? Perhaps we need to think about a gen.api module? This could also incorporate the best ideas in the simple database access module. Regards, Nick. |