def validate_in_transaction(connection):
"""Ensure that `connection` is within a transaction.
This only enquires as to Django's perspective on the situation. It does
not actually check that the database agrees with Django.
:raise TransactionManagementError: If no transaction is in progress.
"""
if not in_transaction(connection):
raise TransactionManagementError(
# XXX: GavinPanella 2015-08-07 bug=1482563: This error message is
# specific to lobjects, but this lives in a general utils module.
"PostgreSQL's large object support demands that all interactions "
"are done in a transaction. Further, lobject() has been known to "
"segfault when used outside of a transaction. This assertion has "
"prevented the use of lobject() outside of a transaction. Please "
"investigate.")
评论列表
文章目录