summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db/item.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/db/item.c')
-rw-r--r--plugins/pychrysalide/analysis/db/item.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/db/item.c b/plugins/pychrysalide/analysis/db/item.c
index 27b5bac..23e6933 100644
--- a/plugins/pychrysalide/analysis/db/item.c
+++ b/plugins/pychrysalide/analysis/db/item.c
@@ -32,6 +32,7 @@
#include <analysis/db/item.h>
+#include "../../access.h"
#include "../../helpers.h"
@@ -165,17 +166,24 @@ PyTypeObject *get_python_db_item_type(void)
* *
******************************************************************************/
-bool register_python_db_item(PyObject *module)
+bool ensure_python_db_item_is_registered(void)
{
- PyTypeObject *py_db_item_type; /* Type Python 'DbItem' */
+ PyTypeObject *type; /* Type Python 'DbItem' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_db_item_type = get_python_db_item_type();
+ type = get_python_db_item_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.format");
+
+ dict = PyModule_GetDict(module);
- if (!register_class_for_pygobject(dict, G_TYPE_DB_ITEM, py_db_item_type, &PyGObject_Type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_DB_ITEM, type, &PyGObject_Type))
+ return false;
+
+ }
return true;