Fix assigning to PropertyLinkSub via Python

This commit is contained in:
wmayer 2013-02-17 14:45:37 +01:00
parent 3c50de4334
commit d477ce66af

View File

@ -254,12 +254,17 @@ void PropertyLinkSub::setPyObject(PyObject *value)
setValue(pcObj->getDocumentObjectPtr(),vals); setValue(pcObj->getDocumentObjectPtr(),vals);
} }
else {
std::string error = std::string("type of first element in tuple must be 'DocumentObject', not ");
error += tup[0].ptr()->ob_type->tp_name;
throw Py::TypeError(error);
}
} }
else if(Py_None == value) { else if(Py_None == value) {
setValue(0); setValue(0);
} }
else { else {
std::string error = std::string("type must be 'DocumentObject', 'NoneType' of ('DocumentObject',['String',]) not "); std::string error = std::string("type must be 'DocumentObject', 'NoneType' or ('DocumentObject',['String',]) not ");
error += value->ob_type->tp_name; error += value->ob_type->tp_name;
throw Py::TypeError(error); throw Py::TypeError(error);
} }