diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-04-24 01:49:49 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-04-24 01:49:49 -0700 |
commit | e5457947f7b9a0498ffe94ca976614fb87544787 (patch) | |
tree | 9a29d7eec9e8a8a8edfcb1fa64dba217b3719ce9 /py/modules/IcePy/ImplicitContext.cpp | |
parent | Fixed bug 3039 (diff) | |
download | ice-e5457947f7b9a0498ffe94ca976614fb87544787.tar.bz2 ice-e5457947f7b9a0498ffe94ca976614fb87544787.tar.xz ice-e5457947f7b9a0498ffe94ca976614fb87544787.zip |
bug 711 - accept Unicode objects in Python
Diffstat (limited to 'py/modules/IcePy/ImplicitContext.cpp')
-rw-r--r-- | py/modules/IcePy/ImplicitContext.cpp | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/py/modules/IcePy/ImplicitContext.cpp b/py/modules/IcePy/ImplicitContext.cpp index 0275180e24d..a06d56ecea8 100644 --- a/py/modules/IcePy/ImplicitContext.cpp +++ b/py/modules/IcePy/ImplicitContext.cpp @@ -129,8 +129,14 @@ extern "C" static PyObject* implicitContextContainsKey(ImplicitContextObject* self, PyObject* args) { - char* key; - if(!PyArg_ParseTuple(args, STRCAST("s"), &key)) + PyObject* keyObj; + if(!PyArg_ParseTuple(args, STRCAST("O"), &keyObj)) + { + return 0; + } + + string key; + if(!getStringArg(keyObj, "key", key)) { return 0; } @@ -155,8 +161,14 @@ extern "C" static PyObject* implicitContextGet(ImplicitContextObject* self, PyObject* args) { - char* key; - if(!PyArg_ParseTuple(args, STRCAST("s"), &key)) + PyObject* keyObj; + if(!PyArg_ParseTuple(args, STRCAST("O"), &keyObj)) + { + return 0; + } + + string key; + if(!getStringArg(keyObj, "key", key)) { return 0; } @@ -180,9 +192,20 @@ extern "C" static PyObject* implicitContextPut(ImplicitContextObject* self, PyObject* args) { - char* key; - char* val; - if(!PyArg_ParseTuple(args, STRCAST("ss"), &key, &val)) + PyObject* keyObj; + PyObject* valueObj; + if(!PyArg_ParseTuple(args, STRCAST("OO"), &keyObj, &valueObj)) + { + return 0; + } + + string key; + string value; + if(!getStringArg(keyObj, "key", key)) + { + return 0; + } + if(!getStringArg(valueObj, "value", value)) { return 0; } @@ -190,7 +213,7 @@ implicitContextPut(ImplicitContextObject* self, PyObject* args) string oldVal; try { - (*self->implicitContext)->put(key, val); + oldVal = (*self->implicitContext)->put(key, value); } catch(const Ice::Exception& ex) { @@ -206,8 +229,14 @@ extern "C" static PyObject* implicitContextRemove(ImplicitContextObject* self, PyObject* args) { - char* key; - if(!PyArg_ParseTuple(args, STRCAST("s"), &key)) + PyObject* keyObj; + if(!PyArg_ParseTuple(args, STRCAST("O"), &keyObj)) + { + return 0; + } + + string key; + if(!getStringArg(keyObj, "key", key)) { return 0; } |