summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Communicator.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2008-04-24 01:49:49 -0700
committerMark Spruiell <mes@zeroc.com>2008-04-24 01:49:49 -0700
commite5457947f7b9a0498ffe94ca976614fb87544787 (patch)
tree9a29d7eec9e8a8a8edfcb1fa64dba217b3719ce9 /py/modules/IcePy/Communicator.cpp
parentFixed bug 3039 (diff)
downloadice-e5457947f7b9a0498ffe94ca976614fb87544787.tar.bz2
ice-e5457947f7b9a0498ffe94ca976614fb87544787.tar.xz
ice-e5457947f7b9a0498ffe94ca976614fb87544787.zip
bug 711 - accept Unicode objects in Python
Diffstat (limited to 'py/modules/IcePy/Communicator.cpp')
-rw-r--r--py/modules/IcePy/Communicator.cpp93
1 files changed, 73 insertions, 20 deletions
diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp
index 6dea0305af6..a8267dae0a0 100644
--- a/py/modules/IcePy/Communicator.cpp
+++ b/py/modules/IcePy/Communicator.cpp
@@ -436,8 +436,14 @@ extern "C"
static PyObject*
communicatorStringToProxy(CommunicatorObject* self, PyObject* args)
{
- char* str;
- if(!PyArg_ParseTuple(args, STRCAST("s"), &str))
+ PyObject* strObj;
+ if(!PyArg_ParseTuple(args, STRCAST("O"), &strObj))
+ {
+ return 0;
+ }
+
+ string str;
+ if(!getStringArg(strObj, "str", str))
{
return 0;
}
@@ -492,8 +498,14 @@ extern "C"
static PyObject*
communicatorPropertyToProxy(CommunicatorObject* self, PyObject* args)
{
- char* str;
- if(!PyArg_ParseTuple(args, STRCAST("s"), &str))
+ PyObject* strObj;
+ if(!PyArg_ParseTuple(args, STRCAST("O"), &strObj))
+ {
+ return 0;
+ }
+
+ string str;
+ if(!getStringArg(strObj, "property", str))
{
return 0;
}
@@ -519,8 +531,14 @@ extern "C"
static PyObject*
communicatorStringToIdentity(CommunicatorObject* self, PyObject* args)
{
- char* str;
- if(!PyArg_ParseTuple(args, STRCAST("s"), &str))
+ PyObject* strObj;
+ if(!PyArg_ParseTuple(args, STRCAST("O"), &strObj))
+ {
+ return 0;
+ }
+
+ string str;
+ if(!getStringArg(strObj, "str", str))
{
return 0;
}
@@ -694,8 +712,14 @@ communicatorAddObjectFactory(CommunicatorObject* self, PyObject* args)
assert(factoryType);
PyObject* factory;
- char* id;
- if(!PyArg_ParseTuple(args, STRCAST("O!s"), factoryType, &factory, &id))
+ PyObject* strObj;
+ if(!PyArg_ParseTuple(args, STRCAST("O!O"), factoryType, &factory, &strObj))
+ {
+ return 0;
+ }
+
+ string id;
+ if(!getStringArg(strObj, "id", id))
{
return 0;
}
@@ -728,8 +752,14 @@ extern "C"
static PyObject*
communicatorFindObjectFactory(CommunicatorObject* self, PyObject* args)
{
- char* id;
- if(!PyArg_ParseTuple(args, STRCAST("s"), &id))
+ PyObject* strObj;
+ if(!PyArg_ParseTuple(args, STRCAST("O"), &strObj))
+ {
+ return 0;
+ }
+
+ string id;
+ if(!getStringArg(strObj, "id", id))
{
return 0;
}
@@ -840,8 +870,14 @@ extern "C"
static PyObject*
communicatorCreateObjectAdapter(CommunicatorObject* self, PyObject* args)
{
- char* name;
- if(!PyArg_ParseTuple(args, STRCAST("s"), &name))
+ PyObject* strObj;
+ if(!PyArg_ParseTuple(args, STRCAST("O"), &strObj))
+ {
+ return 0;
+ }
+
+ string name;
+ if(!getStringArg(strObj, "name", name))
{
return 0;
}
@@ -879,9 +915,20 @@ extern "C"
static PyObject*
communicatorCreateObjectAdapterWithEndpoints(CommunicatorObject* self, PyObject* args)
{
- char* name;
- char* endpoints;
- if(!PyArg_ParseTuple(args, STRCAST("ss"), &name, &endpoints))
+ PyObject* nameObj;
+ PyObject* endpointsObj;
+ if(!PyArg_ParseTuple(args, STRCAST("OO"), &nameObj, &endpointsObj))
+ {
+ return 0;
+ }
+
+ string name;
+ string endpoints;
+ if(!getStringArg(nameObj, "name", name))
+ {
+ return 0;
+ }
+ if(!getStringArg(endpointsObj, "endpoints", endpoints))
{
return 0;
}
@@ -919,9 +966,15 @@ extern "C"
static PyObject*
communicatorCreateObjectAdapterWithRouter(CommunicatorObject* self, PyObject* args)
{
- char* name;
+ PyObject* nameObj;
PyObject* proxy;
- if(!PyArg_ParseTuple(args, STRCAST("sO"), &name, &proxy))
+ if(!PyArg_ParseTuple(args, STRCAST("OO"), &nameObj, &proxy))
+ {
+ return 0;
+ }
+
+ string name;
+ if(!getStringArg(nameObj, "name", name))
{
return 0;
}
@@ -935,7 +988,7 @@ communicatorCreateObjectAdapterWithRouter(CommunicatorObject* self, PyObject* ar
}
else if(proxy != Py_None)
{
- PyErr_Format(PyExc_ValueError, STRCAST("ice_createObjectAdapterWithRouter requires None or Ice.RouterPrx"));
+ PyErr_Format(PyExc_ValueError, STRCAST("createObjectAdapterWithRouter requires None or Ice.RouterPrx"));
return 0;
}
@@ -1018,7 +1071,7 @@ communicatorSetDefaultRouter(CommunicatorObject* self, PyObject* args)
}
else if(proxy != Py_None)
{
- PyErr_Format(PyExc_ValueError, STRCAST("ice_setDefaultRouter requires None or Ice.RouterPrx"));
+ PyErr_Format(PyExc_ValueError, STRCAST("setDefaultRouter requires None or Ice.RouterPrx"));
return 0;
}
@@ -1087,7 +1140,7 @@ communicatorSetDefaultLocator(CommunicatorObject* self, PyObject* args)
}
else if(proxy != Py_None)
{
- PyErr_Format(PyExc_ValueError, STRCAST("ice_setDefaultLocator requires None or Ice.LocatorPrx"));
+ PyErr_Format(PyExc_ValueError, STRCAST("setDefaultLocator requires None or Ice.LocatorPrx"));
return 0;
}