Ask Solem há 10 anos atrás
pai
commit
2abc5dec22
3 ficheiros alterados com 6 adições e 10 exclusões
  1. 4 4
      celery/app/task.py
  2. 1 5
      celery/bin/base.py
  3. 1 1
      celery/tests/fixups/test_django.py

+ 4 - 4
celery/app/task.py

@@ -532,10 +532,10 @@ class Task(object):
             attribute.  Trailing can also be disabled by default using the
             attribute.  Trailing can also be disabled by default using the
             :attr:`trail` attribute
             :attr:`trail` attribute
         :keyword publisher: Deprecated alias to ``producer``.
         :keyword publisher: Deprecated alias to ``producer``.
-        
-        :rtype :class:`celery.result.AsyncResult`: if 
-            :setting:`CELERY_ALWAYS_EAGER` is not set, otherwise 
-            :class:`celery.result.EagerResult`:
+
+        :rtype :class:`celery.result.AsyncResult`: if
+            :setting:`CELERY_ALWAYS_EAGER` is not set, otherwise
+            :class:`celery.result.EagerResult`.
 
 
         Also supports all keyword arguments supported by
         Also supports all keyword arguments supported by
         :meth:`kombu.Producer.publish`.
         :meth:`kombu.Producer.publish`.

+ 1 - 5
celery/bin/base.py

@@ -505,11 +505,7 @@ class Command(object):
         return self.preparse_options(args, self.preload_options)
         return self.preparse_options(args, self.preload_options)
 
 
     def add_append_opt(self, acc, opt, value):
     def add_append_opt(self, acc, opt, value):
-        default = opt.default or []
-
-        if opt.dest not in acc:
-           acc[opt.dest] = default
-
+        acc.setdefault(opt.dest, opt.default or [])
         acc[opt.dest].append(value)
         acc[opt.dest].append(value)
 
 
     def preparse_options(self, args, options):
     def preparse_options(self, args, options):

+ 1 - 1
celery/tests/fixups/test_django.py

@@ -209,7 +209,7 @@ class test_DjangoWorkerFixup(FixupCase):
             conns[1].close.side_effect = KeyError('already closed')
             conns[1].close.side_effect = KeyError('already closed')
             f.database_errors = (KeyError, )
             f.database_errors = (KeyError, )
 
 
-            f._db.connections = Mock() # ConnectionHandler
+            f._db.connections = Mock()  # ConnectionHandler
             f._db.connections.all.side_effect = lambda: conns
             f._db.connections.all.side_effect = lambda: conns
 
 
             f._close_database()
             f._close_database()