App: [skip ci] print deprecation warning if addExtension() has two arguments

This commit is contained in:
wmayer
2021-01-30 17:20:43 +01:00
parent 446ce21517
commit 756654c46e

View File

@@ -198,9 +198,15 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
char *typeId;
if (!PyArg_ParseTuple(args, "s", &typeId))
PyObject* proxy = nullptr;
if (!PyArg_ParseTuple(args, "s|O", &typeId, &proxy))
return NULL;
if (proxy) {
PyErr_SetString(PyExc_DeprecationWarning, "A proxy object as seconbd argument is not needed any more. Please adjust your code");
PyErr_Print();
}
//get the extension type asked for
Base::Type extension = Base::Type::fromName(typeId);
if (extension.isBad() || !extension.isDerivedFrom(App::Extension::getExtensionClassTypeId())) {