s4:lib/messaging - fix up the python bindings
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sat, 7 Nov 2009 16:57:50 +0000 (17:57 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sat, 7 Nov 2009 17:02:05 +0000 (18:02 +0100)
This fixes up the broken "send" method of the python bindings and corrects some
other parameter lists in parsing functions (this is only cosmetic). The reason
for the bug was a superfluous "|"!

source4/lib/messaging/pymessaging.c
source4/lib/messaging/tests/bindings.py

index 33746af26c7076bc07e9c4b3b7bd784a4524729f..0e6fe88b112da6b701502c1623dd04645f2e10d5 100644 (file)
@@ -138,8 +138,9 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa
        const char *kwnames[] = { "target", "msg_type", "data", NULL };
        int length;
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#|:send", 
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#:send", 
                discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &length)) {
+
                return NULL;
        }
 
@@ -176,7 +177,7 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject
        NTSTATUS status;
        const char *kwnames[] = { "callback", "msg_type", NULL };
        
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", 
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:register", 
                discard_const_p(char *, kwnames), &callback, &msg_type)) {
                return NULL;
        }
@@ -207,7 +208,7 @@ static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObjec
        PyObject *callback;
        const char *kwnames[] = { "callback", "msg_type", NULL };
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", 
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:deregister",
                discard_const_p(char *, kwnames), &callback, &msg_type)) {
                return NULL;
        }
@@ -226,7 +227,7 @@ static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject
        char *name;
        const char *kwnames[] = { "name", NULL };
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", 
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:add_name", 
                discard_const_p(char *, kwnames), &name)) {
                return NULL;
        }
@@ -247,7 +248,7 @@ static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObje
        char *name;
        const char *kwnames[] = { "name", NULL };
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", 
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:remove_name",
                discard_const_p(char *, kwnames), &name)) {
                return NULL;
        }
index c89538ddfacd2c48d164fc3de9233f271be95125..ead7a83afdef855a22a71061435e16f561f8ba0b 100644 (file)
@@ -52,6 +52,6 @@ class MessagingTests(TestCase):
         client_ctx = self.get_context((0, 2))
         msg_pong = client_ctx.register(pong_callback)
 
-        client_ctx.send((0,1), msg_ping, "testing")
-        client_ctx.send((0,1), msg_ping, "")
+        client_ctx.send((0, 1), msg_ping, "testing")
+        client_ctx.send((0, 1), msg_ping, "")