Selaa lähdekoodia

Moves mongodb Bunch to celery.utils.objects

Ask Solem 9 vuotta sitten
vanhempi
commit
c5f697829a
2 muutettua tiedostoa jossa 7 lisäystä ja 6 poistoa
  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.