X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=blobdiff_plain;f=src%2Fpython%2Fdatabase.c;fp=src%2Fpython%2Fdatabase.c;h=6d2a54193b818ff862f5b4e0cccbc474488dcb65;hp=0e3ddea8c22b5059e4de74ec9bd6c28566e2448f;hb=d99b0256c9f48132c5c9838afded1a6084d3fd2a;hpb=1a3cb1b405585969da7548ec6b8f29b9bdd984ab diff --git a/src/python/database.c b/src/python/database.c index 0e3ddea..6d2a541 100644 --- a/src/python/database.c +++ b/src/python/database.c @@ -68,10 +68,40 @@ static int Database_init(DatabaseObject* self, PyObject* args, PyObject* kwargs) return 0; } +static PyObject* Database_get_description(DatabaseObject* self) { + const char* description = loc_database_get_description(self->db); + + return PyUnicode_FromString(description); +} + +static PyObject* Database_get_vendor(DatabaseObject* self) { + const char* vendor = loc_database_get_vendor(self->db); + + return PyUnicode_FromString(vendor); +} + static struct PyMethodDef Database_methods[] = { { NULL }, }; +static struct PyGetSetDef Database_getsetters[] = { + { + "description", + (getter)Database_get_description, + NULL, + NULL, + NULL, + }, + { + "vendor", + (getter)Database_get_vendor, + NULL, + NULL, + NULL + }, + { NULL }, +}; + PyTypeObject DatabaseType = { PyVarObject_HEAD_INIT(NULL, 0) tp_name: "location.Database", @@ -82,4 +112,5 @@ PyTypeObject DatabaseType = { tp_init: (initproc)Database_init, tp_doc: "Database object", tp_methods: Database_methods, + tp_getset: Database_getsetters, };