Browse Source

Fix a deprecation warning about logger.warn() (#5078)

* Fix a deprecation warning about logger.warn()

It popped up in one of my projects:
"The 'warn' method is deprecated, use 'warning' instead"

Since we were not using it anywhere, I grepped my site-packages and found a couple of usages in Celery.

* Add myself to the list of contributors
Bruno Alla 6 years ago
parent
commit
7a0ae58e94
2 changed files with 4 additions and 3 deletions
  1. 1 0
      CONTRIBUTORS.txt
  2. 3 3
      celery/backends/redis.py

+ 1 - 0
CONTRIBUTORS.txt

@@ -263,3 +263,4 @@ Josue Balandrano Coronel, 2018/05/24
 Federico Bond, 2018/06/20
 Tom Booth, 2018/07/06
 Axel haustant, 2018/08/14
+Bruno Alla, 2018/09/27

+ 3 - 3
celery/backends/redis.py

@@ -90,7 +90,7 @@ class ResultConsumer(BaseResultConsumer):
             if self._pubsub is not None:
                 self._pubsub.close()
         except KeyError as e:
-            logger.warn(text_t(e))
+            logger.warning(text_t(e))
         super(ResultConsumer, self).on_after_fork()
 
     def _maybe_cancel_ready_task(self, meta):
@@ -238,10 +238,10 @@ class RedisBackend(BaseKeyValueStoreBackend, AsyncBackendMixin):
             if ssl_cert_reqs == 'CERT_REQUIRED':
                 connparams['ssl_cert_reqs'] = CERT_REQUIRED
             elif ssl_cert_reqs == 'CERT_OPTIONAL':
-                logger.warn(W_REDIS_SSL_CERT_OPTIONAL)
+                logger.warning(W_REDIS_SSL_CERT_OPTIONAL)
                 connparams['ssl_cert_reqs'] = CERT_OPTIONAL
             elif ssl_cert_reqs == 'CERT_NONE':
-                logger.warn(W_REDIS_SSL_CERT_NONE)
+                logger.warning(W_REDIS_SSL_CERT_NONE)
                 connparams['ssl_cert_reqs'] = CERT_NONE
             else:
                 raise ValueError(E_REDIS_SSL_CERT_REQS_MISSING)