diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-19 17:32:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-19 17:32:02 +0400 |
commit | d9a7e5144f816bfa15687e5bd9d55e95f69c0269 (patch) | |
tree | ce6119020f1c1b4ae19b7dba1aac3f832ff46083 /source/blender/python/intern/bpy_util.c | |
parent | 8efdb04817b53562b9d8092a5d973981f78703c9 (diff) |
Python operators
- simplified C operator API bpy.__ops__ since its wrapped by python now.
- needs the class to have an __idname__ rather then __name__ (like menus, headers)
- convert python names "console.exec" into blender names "CONSOLE_OT_exec" when registering (store the blender name as class.__idname_bl__, users scripters wont notice)
- bpy.props.props ???, removed
Diffstat (limited to 'source/blender/python/intern/bpy_util.c')
-rw-r--r-- | source/blender/python/intern/bpy_util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index b451923e780..3084cc1f871 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -304,12 +304,21 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute to be a string", class_type, class_attrs->name); return -1; } + if(class_attrs->len != -1 && class_attrs->len < PyUnicode_GetSize(item)) { + PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute string to be shorter then %d", class_type, class_attrs->name, class_attrs->len); + return -1; + } + break; case 'l': if (PyList_Check(item)==0) { PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute to be a list", class_type, class_attrs->name); return -1; } + if(class_attrs->len != -1 && class_attrs->len < PyList_GET_SIZE(item)) { + PyErr_Format( PyExc_AttributeError, "expected %s class \"%s\" attribute list to be shorter then %d", class_type, class_attrs->name, class_attrs->len); + return -1; + } break; case 'f': if (PyMethod_Check(item)) |