MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _accept_read_only

Function _accept_read_only

asyncpg/connect_utils.py:1231–1243  ·  view source on GitHub ↗

Verify the server has not set default_transaction_read_only=True

(should_be_read_only: bool)

Source from the content-addressed store, hash-verified

1229
1230
1231def _accept_read_only(should_be_read_only: bool):
1232 """
1233 Verify the server has not set default_transaction_read_only=True
1234 """
1235 async def can_be_used(connection):
1236 settings = connection.get_settings()
1237 is_readonly = getattr(settings, 'default_transaction_read_only', 'off')
1238
1239 if is_readonly == "on":
1240 return should_be_read_only
1241
1242 return await _accept_in_hot_standby(should_be_read_only)(connection)
1243 return can_be_used
1244
1245
1246async def _accept_any(_):

Callers 1

connect_utils.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected