From f600d9089bc51f37195cae54882c80b575f03d42 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 26 Sep 2023 20:52:20 +0300 Subject: [PATCH] Do not leak `key` loop variable into global namespace (#226) This is a common problem for module level loops / helpers / etc. `key` is importable name, it is even imported when using `from dj_database_url import *`. This is clearly not what we want. --- dj_database_url/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dj_database_url/__init__.py b/dj_database_url/__init__.py index f580f90..7fbd116 100644 --- a/dj_database_url/__init__.py +++ b/dj_database_url/__init__.py @@ -31,6 +31,7 @@ SCHEMES = { # Register database schemes in URLs. for key in SCHEMES.keys(): urlparse.uses_netloc.append(key) +del key # From https://docs.djangoproject.com/en/4.0/ref/settings/#databases