Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-17 15:21:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-17 15:21:41 +0300
commit51f2dcd08ccde78223449383b98b9f7e35062b24 (patch)
treed321846ee9e0d09d87dd9e43cc2a6b5f9edaeada /source
parent7f8a24b614450a05a4b1df80080a19001a851873 (diff)
- access console languages as modules rather then having the py operator call an operator
- workaround for __getattr__ existing for types that dont support it
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_main.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 1b93f6d1056..a068dc7cb26 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -258,7 +258,7 @@ void RNA_def_main(BlenderRNA *brna)
{"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks."},
{"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks."},
{"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks."},
- {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks."},
+/* {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks."}, */
{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED)."},
{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks."},
{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks."},
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index ddc8af117a6..e247b060088 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1205,6 +1205,11 @@ static PyObject *pyrna_struct_subscript( BPy_StructRNA *self, PyObject *key )
IDProperty *group, *idprop;
char *name= _PyUnicode_AsString(key);
+ if(RNA_struct_idproperties_check(&self->ptr)==0) {
+ PyErr_SetString( PyExc_TypeError, "this type doesn't support IDProperties");
+ return NULL;
+ }
+
if(name==NULL) {
PyErr_SetString( PyExc_TypeError, "only strings are allowed as keys of ID properties");
return NULL;
@@ -1512,7 +1517,14 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
FunctionRNA *func;
if(name[0]=='_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups
- ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
+ /* annoying exception, maybe we need to have different types for this... */
+ if((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idproperties_check(&self->ptr)) {
+ PyErr_SetString(PyExc_AttributeError, "StructRNA - no __getitem__ support for this type");
+ ret = NULL;
+ }
+ else {
+ ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
+ }
}
else if ((prop = RNA_struct_find_property(&self->ptr, name))) {
ret = pyrna_prop_to_py(&self->ptr, prop);