Browse Source

Add compat alias: backend.maybe_reraise -> backend.maybe_throw. Closes #3513

Ask Solem 8 years ago
parent
commit
e08620141e
2 changed files with 10 additions and 0 deletions
  1. 2 0
      celery/result.py
  2. 8 0
      docs/whatsnew-4.0.rst

+ 2 - 0
celery/result.py

@@ -295,6 +295,7 @@ class AsyncResult(ResultBase):
         if callback is not None:
             callback(self.id, value)
         return value
+    maybe_reraise = maybe_throw   # XXX compat alias
 
     def _to_remote_traceback(self, tb):
         if tb and tblib is not None and self.app.conf.task_remote_tracebacks:
@@ -531,6 +532,7 @@ class ResultSet(ResultBase):
     def maybe_throw(self, callback=None, propagate=True):
         for result in self.results:
             result.maybe_throw(callback=callback, propagate=propagate)
+    maybe_reraise = maybe_throw  # XXX compat alias.
 
     def waiting(self):
         """Return true if any of the tasks are incomplate.

+ 8 - 0
docs/whatsnew-4.0.rst

@@ -1521,6 +1521,14 @@ Incompatible changes
 
 - Backends: ``backend.get_status()`` renamed to ``backend.get_state()``.
 
+- Backends: ``backend.maybe_reraise()`` renamed to ``.maybe_throw()``
+
+    The promise API uses .throw(), so this change was made to make it more
+    consistent.
+
+    There's an alias available, so you can still use maybe_reraise until
+    Celery 5.0.
+
 .. _v400-unscheduled-removals:
 
 Unscheduled Removals