From 3dad242cb2e4a27731622d6c94ae7fa330bad227 Mon Sep 17 00:00:00 2001 From: Valery Febvre Date: Sun, 16 May 2004 22:32:52 +0000 Subject: New method lasso_node_destroy() added in class LassoNode --- python/lasso.py | 6 +++--- python/lassomod.c | 2 +- python/xml/py_xml.c | 31 +++++++++++++++---------------- python/xml/py_xml.h | 2 +- 4 files changed, 20 insertions(+), 21 deletions(-) (limited to 'python') diff --git a/python/lasso.py b/python/lasso.py index bdf24867..666065ce 100644 --- a/python/lasso.py +++ b/python/lasso.py @@ -61,6 +61,9 @@ class Node: ## #self._o = lassomod.(size) ## if self._o is None: raise Error('lasso_node_new() failed') + def destroy(self): + lassomod.node_destroy(self) + def dump(self, encoding="utf8", format=1): return lassomod.node_dump(self, encoding, format) @@ -76,9 +79,6 @@ class Node: def export_to_soap(self): return lassomod.node_export_to_soap(self) - def destroy(self): - lassomod.node_unref(self) - def get_attr_value(self, name): return lassomod.node_get_attr_value(self, name) diff --git a/python/lassomod.c b/python/lassomod.c index a393cfd5..2d719914 100644 --- a/python/lassomod.c +++ b/python/lassomod.c @@ -63,6 +63,7 @@ static PyMethodDef lasso_methods[] = { /* xml */ /* py_xml.h */ + {"node_destroy", node_destroy, METH_VARARGS}, {"node_dump", node_dump, METH_VARARGS}, {"node_export", node_export, METH_VARARGS}, {"node_export_to_base64", node_export_to_base64, METH_VARARGS}, @@ -71,7 +72,6 @@ static PyMethodDef lasso_methods[] = { {"node_get_attr_value", node_get_attr_value, METH_VARARGS}, {"node_get_child", node_get_child, METH_VARARGS}, {"node_get_content", node_get_content, METH_VARARGS}, - {"node_unref", node_unref, METH_VARARGS}, {"node_verify_signature", node_verify_signature, METH_VARARGS}, /* py_lib_authentication_statement.h */ diff --git a/python/xml/py_xml.c b/python/xml/py_xml.c index d7a44583..4085ccaf 100644 --- a/python/xml/py_xml.c +++ b/python/xml/py_xml.c @@ -43,6 +43,21 @@ PyObject *LassoNode_wrap(LassoNode *node) { /* LassoNode */ /******************************************************************************/ +PyObject *node_destroy(PyObject *self, PyObject *args) { + PyObject *node_obj; + + if (CheckArgs(args, "O:node_destroy")) { + if(!PyArg_ParseTuple(args, (char *) "O:node_destroy", &node_obj)) + return NULL; + } + else return NULL; + + lasso_node_destroy(LassoNode_get(node_obj)); + + Py_INCREF(Py_None); + return (Py_None); +} + PyObject *node_dump(PyObject *self, PyObject *args) { PyObject *node_obj; xmlChar *encoding; @@ -176,22 +191,6 @@ PyObject *node_get_content(PyObject *self, PyObject *args) { return (xmlCharPtr_wrap(ret)); } -PyObject *node_unref(PyObject *self, PyObject *args) { - PyObject *node_obj; - - if (CheckArgs(args, "O:node_unref")) { - if(!PyArg_ParseTuple(args, (char *) "O:node_unref", &node_obj)) - return NULL; - } - else return NULL; - - /* FIXME: should used a fct lasso_node_unref() ??? */ - g_object_unref (G_OBJECT (LassoNode_get(node_obj))); - - Py_INCREF(Py_None); - return (Py_None); -} - PyObject *node_verify_signature(PyObject *self, PyObject *args) { PyObject *node_obj; const gchar *certificate_file; diff --git a/python/xml/py_xml.h b/python/xml/py_xml.h index 82d9fed4..35665f84 100644 --- a/python/xml/py_xml.h +++ b/python/xml/py_xml.h @@ -36,6 +36,7 @@ typedef struct { #define LassoNode_get(v) (((v) == Py_None) ? NULL : (((LassoNode_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) PyObject *LassoNode_wrap(LassoNode *node); +PyObject *node_destroy(PyObject *self, PyObject *args); PyObject *node_dump(PyObject *self, PyObject *args); PyObject *node_export(PyObject *self, PyObject *args); PyObject *node_export_to_base64(PyObject *self, PyObject *args); @@ -44,7 +45,6 @@ PyObject *node_export_to_soap(PyObject *self, PyObject *args); PyObject *node_get_attr_value(PyObject *self, PyObject *args); PyObject *node_get_child(PyObject *self, PyObject *args); PyObject *node_get_content(PyObject *self, PyObject *args); -PyObject *node_unref(PyObject *self, PyObject *args); PyObject *node_verify_signature(PyObject *self, PyObject *args); #endif /* __PYLASSO_PY_XML_H__ */ -- cgit