diff options
author | Jose <jose@zeroc.com> | 2016-03-01 14:33:27 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-03-01 14:33:27 +0100 |
commit | e283494c906ffac2be14f38422934921ea6ae307 (patch) | |
tree | c4b9274845482abd89f84555675d8486a41a71e3 /python/modules/IcePy/Communicator.cpp | |
parent | Rework previous fix for 3.6 compatibility (diff) | |
download | ice-e283494c906ffac2be14f38422934921ea6ae307.tar.bz2 ice-e283494c906ffac2be14f38422934921ea6ae307.tar.xz ice-e283494c906ffac2be14f38422934921ea6ae307.zip |
Ice::identityToString/Ice::stringToIdentity php/ruby/python implementations
Diffstat (limited to 'python/modules/IcePy/Communicator.cpp')
-rw-r--r-- | python/modules/IcePy/Communicator.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/python/modules/IcePy/Communicator.cpp b/python/modules/IcePy/Communicator.cpp index 919086d9ae8..550b0fef0ff 100644 --- a/python/modules/IcePy/Communicator.cpp +++ b/python/modules/IcePy/Communicator.cpp @@ -1715,3 +1715,52 @@ IcePy::getCommunicatorWrapper(const Ice::CommunicatorPtr& communicator) Py_INCREF(obj->wrapper); return obj->wrapper; } + +extern "C" +PyObject* +IcePy_identityToString(PyObject* /*self*/, PyObject* obj) +{ + Ice::Identity id; + if(!getIdentity(obj, id)) + { + return 0; + } + + string str; + + try + { + str = Ice::identityToString(id); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + return createString(str); +} + +extern "C" +PyObject* +IcePy_stringToIdentity(PyObject* /*self*/, PyObject* obj) +{ + string str; + if(!getStringArg(obj, "str", str)) + { + return 0; + } + + Ice::Identity id; + try + { + id = Ice::stringToIdentity(str); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + return createIdentity(id); +} |