do not allow to delete properties in FeaturePythonPyT
This commit is contained in:
parent
f345501dec
commit
025cf18714
|
@ -24,7 +24,7 @@
|
||||||
#define APP_FEATUREPYTHONPYIMP_H
|
#define APP_FEATUREPYTHONPYIMP_H
|
||||||
|
|
||||||
#include <Base/BaseClass.h>
|
#include <Base/BaseClass.h>
|
||||||
#include <Base/PyObjectBase.h>
|
#include <App/PropertyContainerPy.h>
|
||||||
|
|
||||||
namespace App
|
namespace App
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,6 +113,12 @@ int FeaturePythonPyT<FeaturePyT>::__setattr(PyObject *obj, char *attr, PyObject
|
||||||
template<class FeaturePyT>
|
template<class FeaturePyT>
|
||||||
int FeaturePythonPyT<FeaturePyT>::_setattr(char *attr, PyObject *value)
|
int FeaturePythonPyT<FeaturePyT>::_setattr(char *attr, PyObject *value)
|
||||||
{
|
{
|
||||||
|
App::Property *prop = FeaturePyT::getPropertyContainerPtr()->getPropertyByName(attr);
|
||||||
|
if (prop && !value) {
|
||||||
|
PyErr_Format(PyExc_AttributeError, "Cannot delete attribute: '%s'", attr);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int returnValue = FeaturePyT::_setattr(attr, value);
|
int returnValue = FeaturePyT::_setattr(attr, value);
|
||||||
if (returnValue == -1) {
|
if (returnValue == -1) {
|
||||||
PyObject* dict_item = value;
|
PyObject* dict_item = value;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user