summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db/collection.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/db/collection.c')
-rw-r--r--plugins/pychrysalide/analysis/db/collection.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/db/collection.c b/plugins/pychrysalide/analysis/db/collection.c
index 80fcfc2..7f8ac2d 100644
--- a/plugins/pychrysalide/analysis/db/collection.c
+++ b/plugins/pychrysalide/analysis/db/collection.c
@@ -32,6 +32,7 @@
#include <analysis/db/collection.h>
+#include "../../access.h"
#include "../../helpers.h"
@@ -93,17 +94,24 @@ PyTypeObject *get_python_db_collection_type(void)
* *
******************************************************************************/
-bool register_python_db_collection(PyObject *module)
+bool ensure_python_db_collection_is_registered(void)
{
- PyTypeObject *py_db_collection_type; /* Type Python 'DbCollection' */
+ PyTypeObject *type; /* Type Python 'DbCollection' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_db_collection_type = get_python_db_collection_type();
+ type = get_python_db_collection_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.format");
- if (!register_class_for_pygobject(dict, G_TYPE_DB_COLLECTION, py_db_collection_type, &PyGObject_Type))
- return false;
+ dict = PyModule_GetDict(module);
+
+ if (!register_class_for_pygobject(dict, G_TYPE_DB_COLLECTION, type, &PyGObject_Type))
+ return false;
+
+ }
return true;