mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Cleanup: Avoid Python 3.7 deprecation warning on 'async' keyword
Fixes #92
This commit is contained in:
@@ -252,9 +252,9 @@ class MandrillPayload(RequestsPayload):
|
||||
('template_content', combine, None),
|
||||
)
|
||||
|
||||
def set_async(self, async):
|
||||
def set_async(self, is_async):
|
||||
self.deprecated_to_esp_extra('async')
|
||||
self.esp_extra['async'] = async
|
||||
self.esp_extra['async'] = is_async
|
||||
|
||||
def set_ip_pool(self, ip_pool):
|
||||
self.deprecated_to_esp_extra('ip_pool')
|
||||
|
||||
@@ -13,7 +13,12 @@ class MandrillBackendDjrillFeatureTests(MandrillBackendMockAPITestCase):
|
||||
# These features should now be accessed through esp_extra
|
||||
|
||||
def test_async(self):
|
||||
self.message.async = True
|
||||
# async becomes a keyword in Python 3.7. If you have code like this:
|
||||
# self.message.async = True
|
||||
# it should be changed to:
|
||||
# self.message.esp_extra = {"async": True}
|
||||
# (The setattr below keeps these tests compatible, but isn't recommended for your code.)
|
||||
setattr(self.message, 'async', True) # don't do this; use esp_extra instead
|
||||
with self.assertWarnsRegex(DeprecationWarning, 'async'):
|
||||
self.message.send()
|
||||
data = self.get_api_call_json()
|
||||
|
||||
Reference in New Issue
Block a user