From 8d4e1a029eae479607e6c780c36b9f5fa0ad3962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Tue, 24 Mar 2015 16:18:04 +0100 Subject: [PATCH] __dir__ doesn't exist in python 2 Thanks jezdez for reporting! Closes #107 --- elasticsearch_dsl/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch_dsl/utils.py b/elasticsearch_dsl/utils.py index f1dd3ee35..d703f2187 100644 --- a/elasticsearch_dsl/utils.py +++ b/elasticsearch_dsl/utils.py @@ -116,7 +116,7 @@ def __setitem__(self, key, value): self._d_[key] = value def __setattr__(self, name, value): - if name in self._d_ or name not in super(AttrDict, self).__dir__(): + if name in self._d_ or not hasattr(self.__class__, name): self._d_[name] = value else: # there is an attribute on the class (could be property, ..) - don't add it as field