@@ -177,12 +177,16 @@ def psycopg_kwargs_from_settings_dict(settings_dict: dj_db_dict) -> dict:
177177
178178
179179def psycopg_conn_string_from_settings_dict (settings_dict : dj_db_dict ) -> str :
180+ """Returns a string that psycopg can take as conninfo for Connection class.
181+
182+ Example return value: "dbname=postgres user=postgres"
183+ """
180184 conn_params = psycopg_kwargs_from_settings_dict (settings_dict )
181185 return psycopg .conninfo .make_conninfo (** conn_params )
182186
183187
184188def combine_settings_dict (settings_dict1 : dj_db_dict , settings_dict2 : dj_db_dict , ** extra_options ) -> dj_db_dict :
185- """Given two Django settings dictionaries, combine them and return a new settings_dict"""
189+ """Given two Django database settings dictionaries, combine them and return a new settings_dict"""
186190 settings_dict = deepcopy (settings_dict1 )
187191 settings_dict ['OPTIONS' ] = deepcopy (settings_dict .get ('OPTIONS' , {}))
188192
@@ -201,6 +205,12 @@ def combine_settings_dict(settings_dict1: dj_db_dict, settings_dict2: dj_db_dict
201205
202206
203207def get_pg_notify_params (alias : str = DEFAULT_DB_ALIAS , ** extra_options ) -> dict :
208+ """Returns a dictionary that can be used as kwargs to create a psycopg.Connection
209+
210+ This should use the same connection parameters as Django does.
211+ However, this also allows overrides specified by the setting
212+ PG_NOTIFY_DATABASES and then the LISTENER_DATABASES, deprecated AWX setting.
213+ """
204214 pg_notify_overrides = {}
205215 if hasattr (settings , 'PG_NOTIFY_DATABASES' ):
206216 pg_notify_overrides = settings .PG_NOTIFY_DATABASES .get (alias , {})
0 commit comments