prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  TypeError on sendinblue
  https://sentry.prod.mozaws.net/operations/mdn-prod/issues/8473154/?referrer=github_plugin
  
  ```
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
    File "celery/app/trace.py", line 385, in trace_task
      R = retval = fun(*args, **kwargs)
    File "newrelic/hooks/application_celery.py", line 85, in wrapper
      return wrapped(*args, **kwargs)
    File "celery/app/trace.py", line 650, in __protected_call__
      return self.run(*args, **kwargs)
    File "kuma/users/newsletter/tasks.py", line 29, in create_or_update_contact
      "listIds": [int(settings.SENDINBLUE_LIST_ID)],
  
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kuma/users/newsletter/apps.py`
  Content:
  ```
  1 from django.apps import AppConfig
  2 from django.core.checks import register
  3 from django.utils.translation import gettext_lazy as _
  4 
  5 
  6 class UserNewsletterConfig(AppConfig):
  7     """
  8     The Django App Config class to store information about the users app
  9     and do startup time things.
  10     """
  11 
  12     name = "kuma.users.newsletter"
  13     verbose_name = _("UserNewsletter")
  14 
  15     def ready(self):
  16         # Connect signal handlers
  17         from . import signal_handlers  # noqa
  18 
  19         from .checks import sendinblue_check
  20 
  21         register(sendinblue_check)
  22
  ```
  
  Path: `kuma/settings/pytest.py`
  Content:
  ```
  1 from .local import *
  2 
  3 DEBUG = False
  4 ENABLE_RESTRICTIONS_BY_HOST = False
  5 TEMPLATES[0]["OPTIONS"]["debug"] = True  # Enable recording of templates
  6 CELERY_TASK_ALWAYS_EAGER = True
  7 CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
  8 ES_LIVE_INDEX = config("ES_LIVE_INDEX", default=False, cast=bool)
  9 
  10 # Disable the Constance database cache
  11 CONSTANCE_DATABASE_CACHE_BACKEND = False
  12 
  13 # SHA1 because it is fast, and hard-coded in the test fixture JSON.
  14 PASSWORD_HASHERS = ("django.contrib.auth.hashers.SHA1PasswordHasher",)
  15 
  16 INSTALLED_APPS += ("kuma.core.tests.taggit_extras",)
  17 
  18 LOGGING["loggers"].update(
  19     {
  20         "django.db.backends": {
  21             "handlers": ["console"],
  22             "propagate": True,
  23             "level": "WARNING",
  24         },
  25         "kuma.search.utils": {"handlers": [], "propagate": False, "level": "CRITICAL"},
  26     }
  27 )
  28 
  29 
  30 # Change the cache key prefix for tests, to avoid overwriting runtime.
  31 for cache_settings in CACHES.values():
  32     current_prefix = cache_settings.get("KEY_PREFIX", "")
  33     cache_settings["KEY_PREFIX"] = "test." + current_prefix
  34 
  35 # Use un-versioned file names, like main.css, instead of versioned
  36 # filenames requiring hashing, like mdn.1cb62215bf0c.css
  37 STATICFILES_STORAGE = "pipeline.storage.PipelineStorage"
  38 
  39 # Switch Pipeline to DEBUG=False / Production values
  40 
  41 # The documents claim True means assets should be compressed, which seems like
  42 # more work, but it is 4x slower when False, maybe because it detects the
  43 # existence of the file and skips generating a new one.
  44 PIPELINE["PIPELINE_ENABLED"] = True
  45 
  46 # The documents suggest this does nothing when PIPELINE_ENABLED=True. But,
  47 # testing shows that tests run faster when set to True.
  48 PIPELINE["PIPELINE_COLLECTOR_ENABLED"] = True
  49 
  50 # We need the real Sass compiler here instead of the pass-through used for
  51 # local dev.
  52 PIPELINE["COMPILERS"] = ("pipeline.compilers.sass.SASSCompiler",)
  53 
  54 # Testing with django-pipeline 1.6.8, PipelineStorage
  55 # Enabled=T, Collector=T -   482s
  56 # Enabled=T, Collector=F -   535s
  57 # Enabled=F, Collector=T - 18262s
  58 # Enabled=F, Collector=F -  2043s
  59 
  60 # Defer to django-pipeline's finders for testing
  61 # This avoids reading the static folder for each test client request, for
  62 # a 10x speedup on Docker on MacOS.
  63 WHITENOISE_AUTOREFRESH = True
  64 WHITENOISE_USE_FINDERS = True
  65 
  66 # Never rely on the .env
  67 GOOGLE_ANALYTICS_ACCOUNT = None
  68 
  69 # Silence warnings about defaults that change in django-storages 2.0
  70 AWS_BUCKET_ACL = None
  71 AWS_DEFAULT_ACL = None
  72 
  73 # Use a dedicated minio bucket for tests
  74 ATTACHMENTS_AWS_STORAGE_BUCKET_NAME = "test"
  75 
  76 # Never enabled in tests.
  77 SENTRY_DSN = None
  78 
  79 # To make absolutely sure we never accidentally trigger the GA tracking
  80 # within tests to the actual (and default) www.google-analytics.com this is
  81 # an extra safeguard.
  82 GOOGLE_ANALYTICS_TRACKING_URL = "https://thisllneverwork.example.com/collect"
  83 
  84 # Because that's what all the tests presume.
  85 SITE_ID = 1
  86 
  87 # Because it's on by default
  88 ENABLE_BCD_SIGNAL = True
  89 
  90 # Stripe API KEY settings
  91 STRIPE_PUBLIC_KEY = "testing"
  92 STRIPE_SECRET_KEY = "testing"
  93 STRIPE_PLAN_ID = "testing"
  94 
  95 # For legacy reasons, the tests assume these are always true so don't
  96 # let local overrides take effect.
  97 INDEX_HTML_ATTRIBUTES = True
  98 INDEX_CSS_CLASSNAMES = True
  99 
  100 # Amount for the monthly subscription.
  101 # It's hardcoded here in case some test depends on the number and it futureproofs
  102 # our tests to not deviate when the actual number changes since that number
  103 # change shouldn't affect the tests.
  104 CONTRIBUTION_AMOUNT_USD = 4.99
  105
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/kuma/settings/pytest.py b/kuma/settings/pytest.py
  --- a/kuma/settings/pytest.py
  +++ b/kuma/settings/pytest.py
  @@ -102,3 +102,6 @@
   # our tests to not deviate when the actual number changes since that number
   # change shouldn't affect the tests.
   CONTRIBUTION_AMOUNT_USD = 4.99
  +
  +SENDINBLUE_API_KEY = "testing"
  +SENDINBLUE_LIST_ID = 7327
  diff --git a/kuma/users/newsletter/apps.py b/kuma/users/newsletter/apps.py
  --- a/kuma/users/newsletter/apps.py
  +++ b/kuma/users/newsletter/apps.py
  @@ -1,4 +1,5 @@
   from django.apps import AppConfig
  +from django.conf import settings
   from django.core.checks import register
   from django.utils.translation import gettext_lazy as _
   
  @@ -13,6 +14,9 @@
       verbose_name = _("UserNewsletter")
   
       def ready(self):
  +        if not settings.SENDINBLUE_API_KEY:
  +            return
  +
           # Connect signal handlers
           from . import signal_handlers  # noqa
  
verification_info: {"golden_diff": "diff --git a/kuma/settings/pytest.py b/kuma/settings/pytest.py\n--- a/kuma/settings/pytest.py\n+++ b/kuma/settings/pytest.py\n@@ -102,3 +102,6 @@\n # our tests to not deviate when the actual number changes since that number\n # change shouldn't affect the tests.\n CONTRIBUTION_AMOUNT_USD = 4.99\n+\n+SENDINBLUE_API_KEY = \"testing\"\n+SENDINBLUE_LIST_ID = 7327\ndiff --git a/kuma/users/newsletter/apps.py b/kuma/users/newsletter/apps.py\n--- a/kuma/users/newsletter/apps.py\n+++ b/kuma/users/newsletter/apps.py\n@@ -1,4 +1,5 @@\n from django.apps import AppConfig\n+from django.conf import settings\n from django.core.checks import register\n from django.utils.translation import gettext_lazy as _\n \n@@ -13,6 +14,9 @@\n     verbose_name = _(\"UserNewsletter\")\n \n     def ready(self):\n+        if not settings.SENDINBLUE_API_KEY:\n+            return\n+\n         # Connect signal handlers\n         from . import signal_handlers  # noqa\n", "issue": "TypeError on sendinblue\nhttps://sentry.prod.mozaws.net/operations/mdn-prod/issues/8473154/?referrer=github_plugin\n\n```\nTypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'\n  File \"celery/app/trace.py\", line 385, in trace_task\n    R = retval = fun(*args, **kwargs)\n  File \"newrelic/hooks/application_celery.py\", line 85, in wrapper\n    return wrapped(*args, **kwargs)\n  File \"celery/app/trace.py\", line 650, in __protected_call__\n    return self.run(*args, **kwargs)\n  File \"kuma/users/newsletter/tasks.py\", line 29, in create_or_update_contact\n    \"listIds\": [int(settings.SENDINBLUE_LIST_ID)],\n\nTypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'\n```\n", "before_files": [{"content": "from django.apps import AppConfig\nfrom django.core.checks import register\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass UserNewsletterConfig(AppConfig):\n    \"\"\"\n    The Django App Config class to store information about the users app\n    and do startup time things.\n    \"\"\"\n\n    name = \"kuma.users.newsletter\"\n    verbose_name = _(\"UserNewsletter\")\n\n    def ready(self):\n        # Connect signal handlers\n        from . import signal_handlers  # noqa\n\n        from .checks import sendinblue_check\n\n        register(sendinblue_check)\n", "path": "kuma/users/newsletter/apps.py"}, {"content": "from .local import *\n\nDEBUG = False\nENABLE_RESTRICTIONS_BY_HOST = False\nTEMPLATES[0][\"OPTIONS\"][\"debug\"] = True  # Enable recording of templates\nCELERY_TASK_ALWAYS_EAGER = True\nCELERY_EAGER_PROPAGATES_EXCEPTIONS = True\nES_LIVE_INDEX = config(\"ES_LIVE_INDEX\", default=False, cast=bool)\n\n# Disable the Constance database cache\nCONSTANCE_DATABASE_CACHE_BACKEND = False\n\n# SHA1 because it is fast, and hard-coded in the test fixture JSON.\nPASSWORD_HASHERS = (\"django.contrib.auth.hashers.SHA1PasswordHasher\",)\n\nINSTALLED_APPS += (\"kuma.core.tests.taggit_extras\",)\n\nLOGGING[\"loggers\"].update(\n    {\n        \"django.db.backends\": {\n            \"handlers\": [\"console\"],\n            \"propagate\": True,\n            \"level\": \"WARNING\",\n        },\n        \"kuma.search.utils\": {\"handlers\": [], \"propagate\": False, \"level\": \"CRITICAL\"},\n    }\n)\n\n\n# Change the cache key prefix for tests, to avoid overwriting runtime.\nfor cache_settings in CACHES.values():\n    current_prefix = cache_settings.get(\"KEY_PREFIX\", \"\")\n    cache_settings[\"KEY_PREFIX\"] = \"test.\" + current_prefix\n\n# Use un-versioned file names, like main.css, instead of versioned\n# filenames requiring hashing, like mdn.1cb62215bf0c.css\nSTATICFILES_STORAGE = \"pipeline.storage.PipelineStorage\"\n\n# Switch Pipeline to DEBUG=False / Production values\n\n# The documents claim True means assets should be compressed, which seems like\n# more work, but it is 4x slower when False, maybe because it detects the\n# existence of the file and skips generating a new one.\nPIPELINE[\"PIPELINE_ENABLED\"] = True\n\n# The documents suggest this does nothing when PIPELINE_ENABLED=True. But,\n# testing shows that tests run faster when set to True.\nPIPELINE[\"PIPELINE_COLLECTOR_ENABLED\"] = True\n\n# We need the real Sass compiler here instead of the pass-through used for\n# local dev.\nPIPELINE[\"COMPILERS\"] = (\"pipeline.compilers.sass.SASSCompiler\",)\n\n# Testing with django-pipeline 1.6.8, PipelineStorage\n# Enabled=T, Collector=T -   482s\n# Enabled=T, Collector=F -   535s\n# Enabled=F, Collector=T - 18262s\n# Enabled=F, Collector=F -  2043s\n\n# Defer to django-pipeline's finders for testing\n# This avoids reading the static folder for each test client request, for\n# a 10x speedup on Docker on MacOS.\nWHITENOISE_AUTOREFRESH = True\nWHITENOISE_USE_FINDERS = True\n\n# Never rely on the .env\nGOOGLE_ANALYTICS_ACCOUNT = None\n\n# Silence warnings about defaults that change in django-storages 2.0\nAWS_BUCKET_ACL = None\nAWS_DEFAULT_ACL = None\n\n# Use a dedicated minio bucket for tests\nATTACHMENTS_AWS_STORAGE_BUCKET_NAME = \"test\"\n\n# Never enabled in tests.\nSENTRY_DSN = None\n\n# To make absolutely sure we never accidentally trigger the GA tracking\n# within tests to the actual (and default) www.google-analytics.com this is\n# an extra safeguard.\nGOOGLE_ANALYTICS_TRACKING_URL = \"https://thisllneverwork.example.com/collect\"\n\n# Because that's what all the tests presume.\nSITE_ID = 1\n\n# Because it's on by default\nENABLE_BCD_SIGNAL = True\n\n# Stripe API KEY settings\nSTRIPE_PUBLIC_KEY = \"testing\"\nSTRIPE_SECRET_KEY = \"testing\"\nSTRIPE_PLAN_ID = \"testing\"\n\n# For legacy reasons, the tests assume these are always true so don't\n# let local overrides take effect.\nINDEX_HTML_ATTRIBUTES = True\nINDEX_CSS_CLASSNAMES = True\n\n# Amount for the monthly subscription.\n# It's hardcoded here in case some test depends on the number and it futureproofs\n# our tests to not deviate when the actual number changes since that number\n# change shouldn't affect the tests.\nCONTRIBUTION_AMOUNT_USD = 4.99\n", "path": "kuma/settings/pytest.py"}], "after_files": [{"content": "from django.apps import AppConfig\nfrom django.conf import settings\nfrom django.core.checks import register\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass UserNewsletterConfig(AppConfig):\n    \"\"\"\n    The Django App Config class to store information about the users app\n    and do startup time things.\n    \"\"\"\n\n    name = \"kuma.users.newsletter\"\n    verbose_name = _(\"UserNewsletter\")\n\n    def ready(self):\n        if not settings.SENDINBLUE_API_KEY:\n            return\n\n        # Connect signal handlers\n        from . import signal_handlers  # noqa\n\n        from .checks import sendinblue_check\n\n        register(sendinblue_check)\n", "path": "kuma/users/newsletter/apps.py"}, {"content": "from .local import *\n\nDEBUG = False\nENABLE_RESTRICTIONS_BY_HOST = False\nTEMPLATES[0][\"OPTIONS\"][\"debug\"] = True  # Enable recording of templates\nCELERY_TASK_ALWAYS_EAGER = True\nCELERY_EAGER_PROPAGATES_EXCEPTIONS = True\nES_LIVE_INDEX = config(\"ES_LIVE_INDEX\", default=False, cast=bool)\n\n# Disable the Constance database cache\nCONSTANCE_DATABASE_CACHE_BACKEND = False\n\n# SHA1 because it is fast, and hard-coded in the test fixture JSON.\nPASSWORD_HASHERS = (\"django.contrib.auth.hashers.SHA1PasswordHasher\",)\n\nINSTALLED_APPS += (\"kuma.core.tests.taggit_extras\",)\n\nLOGGING[\"loggers\"].update(\n    {\n        \"django.db.backends\": {\n            \"handlers\": [\"console\"],\n            \"propagate\": True,\n            \"level\": \"WARNING\",\n        },\n        \"kuma.search.utils\": {\"handlers\": [], \"propagate\": False, \"level\": \"CRITICAL\"},\n    }\n)\n\n\n# Change the cache key prefix for tests, to avoid overwriting runtime.\nfor cache_settings in CACHES.values():\n    current_prefix = cache_settings.get(\"KEY_PREFIX\", \"\")\n    cache_settings[\"KEY_PREFIX\"] = \"test.\" + current_prefix\n\n# Use un-versioned file names, like main.css, instead of versioned\n# filenames requiring hashing, like mdn.1cb62215bf0c.css\nSTATICFILES_STORAGE = \"pipeline.storage.PipelineStorage\"\n\n# Switch Pipeline to DEBUG=False / Production values\n\n# The documents claim True means assets should be compressed, which seems like\n# more work, but it is 4x slower when False, maybe because it detects the\n# existence of the file and skips generating a new one.\nPIPELINE[\"PIPELINE_ENABLED\"] = True\n\n# The documents suggest this does nothing when PIPELINE_ENABLED=True. But,\n# testing shows that tests run faster when set to True.\nPIPELINE[\"PIPELINE_COLLECTOR_ENABLED\"] = True\n\n# We need the real Sass compiler here instead of the pass-through used for\n# local dev.\nPIPELINE[\"COMPILERS\"] = (\"pipeline.compilers.sass.SASSCompiler\",)\n\n# Testing with django-pipeline 1.6.8, PipelineStorage\n# Enabled=T, Collector=T -   482s\n# Enabled=T, Collector=F -   535s\n# Enabled=F, Collector=T - 18262s\n# Enabled=F, Collector=F -  2043s\n\n# Defer to django-pipeline's finders for testing\n# This avoids reading the static folder for each test client request, for\n# a 10x speedup on Docker on MacOS.\nWHITENOISE_AUTOREFRESH = True\nWHITENOISE_USE_FINDERS = True\n\n# Never rely on the .env\nGOOGLE_ANALYTICS_ACCOUNT = None\n\n# Silence warnings about defaults that change in django-storages 2.0\nAWS_BUCKET_ACL = None\nAWS_DEFAULT_ACL = None\n\n# Use a dedicated minio bucket for tests\nATTACHMENTS_AWS_STORAGE_BUCKET_NAME = \"test\"\n\n# Never enabled in tests.\nSENTRY_DSN = None\n\n# To make absolutely sure we never accidentally trigger the GA tracking\n# within tests to the actual (and default) www.google-analytics.com this is\n# an extra safeguard.\nGOOGLE_ANALYTICS_TRACKING_URL = \"https://thisllneverwork.example.com/collect\"\n\n# Because that's what all the tests presume.\nSITE_ID = 1\n\n# Because it's on by default\nENABLE_BCD_SIGNAL = True\n\n# Stripe API KEY settings\nSTRIPE_PUBLIC_KEY = \"testing\"\nSTRIPE_SECRET_KEY = \"testing\"\nSTRIPE_PLAN_ID = \"testing\"\n\n# For legacy reasons, the tests assume these are always true so don't\n# let local overrides take effect.\nINDEX_HTML_ATTRIBUTES = True\nINDEX_CSS_CLASSNAMES = True\n\n# Amount for the monthly subscription.\n# It's hardcoded here in case some test depends on the number and it futureproofs\n# our tests to not deviate when the actual number changes since that number\n# change shouldn't affect the tests.\nCONTRIBUTION_AMOUNT_USD = 4.99\n\nSENDINBLUE_API_KEY = \"testing\"\nSENDINBLUE_LIST_ID = 7327\n", "path": "kuma/settings/pytest.py"}]}