Browse Source

celery.conf.add_defaults now supports adding non-Mapping objects

Ask Solem 12 years ago
parent
commit
cb5eec4f0c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      celery/datastructures.py

+ 3 - 1
celery/datastructures.py

@@ -11,7 +11,7 @@ from __future__ import absolute_import, print_function, unicode_literals
 import sys
 import sys
 import time
 import time
 
 
-from collections import defaultdict, MutableMapping
+from collections import defaultdict, Mapping, MutableMapping
 from heapq import heapify, heappush, heappop
 from heapq import heapify, heappush, heappop
 from functools import partial
 from functools import partial
 from itertools import chain
 from itertools import chain
@@ -435,6 +435,8 @@ class ConfigurationView(AttributeDictMixin):
                              _order=[changes] + defaults)
                              _order=[changes] + defaults)
 
 
     def add_defaults(self, d):
     def add_defaults(self, d):
+        if not isinstance(d, Mapping):
+            d = DictAttribute(d)
         self.defaults.insert(0, d)
         self.defaults.insert(0, d)
         self._order.insert(1, d)
         self._order.insert(1, d)