From 006d5e82e8494ef19759f28d92088ebc27dedd3d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 9 Jun 2010 19:44:06 +0000 Subject: [PATCH] more cleanup to bpy.context.copy(), exclude rna values and its self. --- release/scripts/modules/bpy_types.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index c8153ce9b74..0ba36a7c092 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -29,14 +29,14 @@ class Context(StructRNA): __slots__ = () def copy(self): - import types + from types import BuiltinMethodType new_context = {} - generic_keys = StructRNA.__dict__.keys() - for item in dir(self): - if item not in generic_keys: - value = getattr(self, item) - if type(value) != types.BuiltinMethodType: - new_context[item] = getattr(self, item) + generic_attrs = list(StructRNA.__dict__.keys()) + ["bl_rna", "rna_type", "copy"] + for attr in dir(self): + if not (attr.startswith("_") or attr in generic_attrs): + value = getattr(self, attr) + if type(value) != BuiltinMethodType: + new_context[attr] = value return new_context