Whole file

joke2k/django-environ

The author described this change as Fix db_url_config to work the same for all postgres-like schemes. It counts as a record because the check below fails on the code as it stood at 3e02a6445 and passes on f8ba4f6c6, with nothing else changed between the two runs.

Fix saved2021-09-01
Sharing licenceMIT · LICENSE.txt
Change size+3 1

What the code was meant to do, written into the code itself as a save note

Fix db_url_config to work the same for all postgres-like schemes

The change

8080 BOOLEAN_TRUE_STRINGS = ('true', 'on', 'ok', 'y', 'yes', '1')
8181 URL_CLASS = ParseResult
8282 DEFAULT_DATABASE_ENV = 'DATABASE_URL'
83+
84+ POSTGRES_FAMILY = ('postgres', 'postgresql', 'psql', 'pgsql', 'postgis')
8385 DB_SCHEMES = {
8486 'postgres': DJANGO_POSTGRES,
8587 'postgresql': DJANGO_POSTGRES,
480482 'PORT': _cast_int(url.port) or '',
481483 })
482484
483- if url.scheme == 'postgres' and path.startswith('/'):
485+ if url.scheme in cls.POSTGRES_FAMILY and path.startswith('/'):
484486 config['HOST'], config['NAME'] = path.rsplit('/', 1)
485487
486488 if url.scheme == 'oracle' and path == '':

The check that tells the two apart

failpass·tests/test_db.py::test_postgres_like_scheme_parsing[postgresql]

Check file tests/test_db.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it3e02a644584e6dda44b2fa9176ad4c759d169916
Broken version dated2021-09-01
Moduleenviron.environ
Units changedEnv
Fingerprintdbd41592be038427
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in joke2k/django-environ