From f510026ff7e0b0c49402f2ea755a3fae15c6b4e0 Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Fri, 12 Apr 2013 16:23:09 +0200 Subject: [PATCH] Fix a problem when a complex type has a 'attr' attribute, due to the DataHolder __slots__ list construction, which leads to a DataHolder having a wsattr. --- wsme/types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wsme/types.py b/wsme/types.py index 7773b02..58264c3 100644 --- a/wsme/types.py +++ b/wsme/types.py @@ -469,8 +469,13 @@ def list_attributes(class_): def make_dataholder(class_): + # the slots are computed outside the class scope to avoid + # 'attr' to pullute the class namespace, which leads to weird + # things if one of the slots is named 'attr'. + slots = [attr.key for attr in class_._wsme_attributes] + class DataHolder(object): - __slots__ = [attr.key for attr in class_._wsme_attributes] + __slots__ = slots DataHolder.__name__ = class_.__name__ + 'DataHolder' return DataHolder