Re: Database API table methods

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Database API table methods

Nick Hall
On 01/10/17 18:36, Paul Culley wrote:
I do think that having ONE general purpose method for all objects/functions is desirable; I don't care if it is get_table_metadata or db.get_method('get_%s_from_handle', obj_type) as long as I don't need to keep checking if the function is valid across all db types, and works for obj_types that might be either lower or title case, singular or plural.

OK.  I have created a new convenience function in PR #476.

https://github.com/gramps-project/gramps/pull/476

Examples:

db.method('get_%s_from_handle', 'Person')
db.method('get_%s_from_%s', 'Event', 'gramps_id')

Returns None if the method doesn't exist.

Formats 'iter_%s' and 'get_number_of_%s' use the plural forms and are not yet implemented.  No code needed these at the moment.

Nick.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel