瀏覽代碼

Moves mongodb Bunch to celery.utils.objects

Ask Solem 9 年之前
父節點
當前提交
c5f697829a
共有 2 個文件被更改,包括 7 次插入6 次删除
  1. 0 6
      celery/backends/mongodb.py
  2. 7 0
      celery/utils/objects.py

+ 0 - 6
celery/backends/mongodb.py

@@ -38,12 +38,6 @@ else:                                       # pragma: no cover
 __all__ = ['MongoBackend']
 
 
-class Bunch(object):
-
-    def __init__(self, **kw):
-        self.__dict__.update(kw)
-
-
 class MongoBackend(BaseBackend):
 
     mongo_host = None

+ 7 - 0
celery/utils/objects.py

@@ -11,6 +11,13 @@ from __future__ import absolute_import
 __all__ = ['mro_lookup']
 
 
+class Bunch(object):
+    """Object that enables you to modify attributes."""
+
+    def __init__(self, **kwargs):
+        self.__dict__.update(kwargs)
+
+
 def mro_lookup(cls, attr, stop=(), monkey_patched=[]):
     """Return the first node by MRO order that defines an attribute.