summaryrefslogtreecommitdiff
path: root/python/modules/IcePy/Communicator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'python/modules/IcePy/Communicator.cpp')
-rw-r--r--python/modules/IcePy/Communicator.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/python/modules/IcePy/Communicator.cpp b/python/modules/IcePy/Communicator.cpp
index 1549cd1043c..eb223c85853 100644
--- a/python/modules/IcePy/Communicator.cpp
+++ b/python/modules/IcePy/Communicator.cpp
@@ -1740,19 +1740,34 @@ IcePy::getCommunicatorWrapper(const Ice::CommunicatorPtr& communicator)
extern "C"
PyObject*
-IcePy_identityToString(PyObject* /*self*/, PyObject* obj)
+IcePy_identityToString(PyObject* /*self*/, PyObject* args)
{
+ PyObject* identityType = lookupType("Ice.Identity");
+ PyObject* obj;
+ PyObject* mode = 0;
+ if(!PyArg_ParseTuple(args, STRCAST("O!O"), identityType, &obj, &mode))
+ {
+ return 0;
+ }
+
Ice::Identity id;
if(!getIdentity(obj, id))
{
return 0;
}
-
+
+ Ice::ToStringMode toStringMode = Ice::Unicode;
+ if(mode != Py_None && PyObject_HasAttrString(mode, STRCAST("value")))
+ {
+ PyObjectHandle modeValue = PyObject_GetAttrString(mode, STRCAST("value"));
+ toStringMode = static_cast<Ice::ToStringMode>(PyLong_AsLong(modeValue.get()));
+ }
+
string str;
try
{
- str = Ice::identityToString(id);
+ str = identityToString(id, toStringMode);
}
catch(const Ice::Exception& ex)
{