Commit Graph

14175 Commits

Author SHA1 Message Date
Aymeric Augustin 679af4058d Restricted a workaround for a bug in Python to the affected versions. 2013-03-12 14:05:10 +01:00
Tim Graham e1bafdbffa Fixed #19965 - Added a warning that the tutorial is written for Python 2.
Thanks itsallvoodoo for the patch.
2013-03-12 08:04:32 -04:00
Aymeric Augustin 885d98d24a Fixed #20028 -- Made atomic usable on callable instances.
Thanks Anssi for the report.
2013-03-12 10:52:16 +01:00
Aymeric Augustin 4846e2b744 Removed unused imports.
One of these functions didn't exist anymore.
2013-03-12 10:09:04 +01:00
Ramiro Morales 7e26f4cb79 Fixed broken link in binary fields doc. 2013-03-11 22:09:21 -03:00
Aymeric Augustin f8a634afa2 Fixed tests that relied on MANAGERS not being empty.
Regression in d0561242.
2013-03-11 23:30:02 +01:00
Aymeric Augustin 94521f50aa Fixed #20026 -- Typo in Apache auth docs. 2013-03-11 22:48:03 +01:00
Aymeric Augustin a50e0c9fdc Fixed a refactoring error in ba5138b1.
Thanks Florian for tracing the error.
2013-03-11 22:40:13 +01:00
Simon Charette bc7a10299f Fixed #20010 -- Make sure `last_executed_query` contains it's associated parameters on Oracle.
Also removed some unused imports.
2013-03-11 17:30:23 -04:00
Aymeric Augustin 1b12e248ea Fixed #11569 -- Wrapped DatabaseCache._base_set in an atomic block.
The atomic block provides a clean rollback to a savepoint on failed writes.

The ticket reported a race condition which I don't know how to test.
2013-03-11 22:19:48 +01:00
Jacob Kaplan-Moss faabf3614e Merge branch 'deprecate-comments' 2013-03-11 15:39:13 -05:00
Jacob Kaplan-Moss d056124269 Remove a special case for comment tests from runtests.py. 2013-03-11 15:38:53 -05:00
Jacob Kaplan-Moss 571b2d139b Deprecated django.contrib.comments. 2013-03-11 15:38:40 -05:00
Aymeric Augustin f2f98abb95 Avoided closing the database connection within a transaction.
Refs #9437.
2013-03-11 21:08:49 +01:00
Aymeric Augustin b746f8a9e3 Adjusted query counts to account for new savepoints. 2013-03-11 21:07:19 +01:00
Aymeric Augustin 1adb7b3c38 Ported layermapping for autocommit. 2013-03-11 20:03:17 +01:00
Aymeric Augustin 3710a918b2 Switched the admin to use @transaction.atomic. 2013-03-11 19:58:08 +01:00
Aymeric Augustin 55a9be8ecf Ran a test that closes the database connection outside of a transaction. 2013-03-11 19:42:59 +01:00
Claude Paroz 9b74a8391d Removed forced settings in runtests
Tests that require USE_I18N, LOGIN_URL or certain MIDDLEWARE_CLASSES
should be decorated appropriately.
2013-03-11 17:46:56 +01:00
Aymeric Augustin 3f1efc44f6 Fixed loaddata command, broken in the previous merge. 2013-03-11 15:43:42 +01:00
Aymeric Augustin 14cddf51c5 Merged branch 'database-level-autocommit'.
Fixed #2227: `atomic` supports nesting.
Fixed #6623: `commit_manually` is deprecated and `atomic` doesn't suffer from this defect.
Fixed #8320: the problem wasn't identified, but the legacy transaction management is deprecated.
Fixed #10744: the problem wasn't identified, but the legacy transaction management is deprecated.
Fixed #10813: since autocommit is enabled, it isn't necessary to rollback after errors any more.
Fixed #13742: savepoints are now implemented for SQLite.
Fixed #13870: transaction management in long running processes isn't a problem any more, and it's documented.
Fixed #14970: while it digresses on transaction management, this ticket essentially asks for autocommit on PostgreSQL.
Fixed #15694: `atomic` supports nesting.
Fixed #17887: autocommit makes it impossible for a connection to stay "idle of transaction".
2013-03-11 15:11:34 +01:00
Aymeric Augustin e654180ce2 Improved the API of set_autocommit. 2013-03-11 15:10:58 +01:00
Aymeric Augustin f32100939e Abused atomic for transaction handling in TestCase.
It isn't necessary to disable set_autocommit since its use is prohibited
inside an atomic block. It's still necessary to disable the legacy
transaction management methods for backwards compatibility, until
they're removed.
2013-03-11 15:05:05 +01:00
Aymeric Augustin d04964e70d Used commit_on_success_unless_managed in loaddata. 2013-03-11 15:05:05 +01:00
Aymeric Augustin 4dbd1b2dd8 Used commit_on_success_unless_managed to make ORM operations atomic. 2013-03-11 15:05:05 +01:00
Aymeric Augustin 86fd920f67 Removed a test that no longer makes any sense.
Since unmanaged == autocommit, there's nothing to commit or roll back.
2013-03-11 15:05:04 +01:00
Aymeric Augustin 0cee3c0e43 Updated a test that doesn't make sense with autocommit. 2013-03-11 15:05:04 +01:00
Aymeric Augustin 423c0d5e29 Added a safety net for developers messing with autocommit. 2013-03-11 15:05:04 +01:00
Aymeric Augustin 107d9b1d97 Added an option to disable the creation of savepoints in atomic. 2013-03-11 15:05:04 +01:00
Aymeric Augustin 189fb4e294 Added a note about long-running processes.
There isn't much else to say, really.
2013-03-11 15:05:04 +01:00
Aymeric Augustin 17cf29920b Added an explanation of transactions and grouped low-level APIs. 2013-03-11 15:05:02 +01:00
Aymeric Augustin ffe41591e7 Updated the documentation for savepoints.
Apparently django.db.transaction used to be an object.
2013-03-11 15:04:10 +01:00
Aymeric Augustin 557e404127 Re-ordered functions by deprecation status. 2013-03-11 15:04:10 +01:00
Aymeric Augustin ac37ed21b3 Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.
Replaced them with per-database options, for proper multi-db support.

Also toned down the recommendation to tie transactions to HTTP requests.
Thanks Jeremy for sharing his experience.
2013-03-11 15:04:05 +01:00
Aymeric Augustin f7245b83bb Implemented atomic_if_autocommit.
It disables transaction management entirely when AUTOCOMMIT is False.
2013-03-11 14:48:55 +01:00
Aymeric Augustin 09ba70f9f1 Made transaction management work even before the first SQL query.
Thanks Florian again.
2013-03-11 14:48:55 +01:00
Aymeric Augustin 7c46c8d5f2 Added some assertions to enforce the atomicity of atomic. 2013-03-11 14:48:55 +01:00
Aymeric Augustin d7bc4fbc94 Implemented an 'atomic' decorator and context manager.
Currently it only works in autocommit mode.

Based on @xact by Christophe Pettus.
2013-03-11 14:48:55 +01:00
Aymeric Augustin 4b31a6a9e6 Added support for savepoints in SQLite.
Technically speaking they aren't usable yet.
2013-03-11 14:48:55 +01:00
Aymeric Augustin e264f67174 Refactored implementation of savepoints.
Prepared for using savepoints within transactions in autocommit mode.
2013-03-11 14:48:55 +01:00
Aymeric Augustin 918f44e3ae Moved standard SQL for savepoints in the base backend.
These methods are only called when uses_savepoints = True anyway.
2013-03-11 14:48:54 +01:00
Aymeric Augustin 3bdc7a6a70 Deprecated transaction.is_managed().
It's synchronized with the autocommit flag.
2013-03-11 14:48:54 +01:00
Aymeric Augustin ba5138b1c0 Deprecated transaction.commit/rollback_unless_managed.
Since "unless managed" now means "if database-level autocommit",
committing or rolling back doesn't have any effect.

Restored transactional integrity in a few places that relied on
automatically-started transactions with a transitory API.
2013-03-11 14:48:54 +01:00
Aymeric Augustin 14aa563f51 Removed superfluous code now that connections use autocommit by default. 2013-03-11 14:48:54 +01:00
Aymeric Augustin 5e27debc5c Enabled database-level autocommit for all backends.
This is mostly a documentation change.

It has the same backwards-incompatibility consequences as those
described for PostgreSQL in a previous commit.
2013-03-11 14:48:54 +01:00
Aymeric Augustin cfc114e00e Removed _enter/_leave_transaction_management.
The goal is to make all databases share a common, autocommit-based,
implementation.
2013-03-11 14:48:54 +01:00
Aymeric Augustin 1617557ae3 Added BaseDatabaseWrapper.ensure_connection.
This API is useful because autocommit cannot be managed without an open
connection.
2013-03-11 14:48:54 +01:00
Aymeric Augustin 7b4815b455 Expressed the dirty flag handling logic in terms of autocommit. 2013-03-11 14:48:54 +01:00
Aymeric Augustin cd364efa00 Stopped flipping the uses_savepoints feature at runtime. 2013-03-11 14:48:54 +01:00
Aymeric Augustin af9e9386eb Enabled autocommit for PostgreSQL.
For users who didn't activate autocommit in their database options, this
is backwards-incompatible in "non-managed" aka "auto" transaction state.
This state now uses database-level autocommit instead of ORM-level
autocommit.

Also removed the uses_autocommit feature which lost its purpose.
2013-03-11 14:48:54 +01:00