1
0
mirror of https://github.com/django/django.git synced 2024-12-26 11:06:07 +00:00
Commit Graph

14269 Commits

Author SHA1 Message Date
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
Aymeric Augustin
8717b0668c Separated autocommit and isolation level handling for PostgreSQL.
Autocommit cannot be manipulated independently from an open connection.
This commit introduces a minor change in behavior: entering transaction
management forces opening a databasse connection. This shouldn't be
backwards incompatible in any practical use case.
2013-03-11 14:48:54 +01:00
Aymeric Augustin
f515619494 Added an API to control database-level autocommit. 2013-03-11 14:48:53 +01:00
Aymeric Augustin
7aacde84f2 Made transaction.managed a no-op and deprecated it.
enter_transaction_management() was nearly always followed by managed().

In three places it wasn't, but they will all be refactored eventually.
The "forced" keyword argument avoids introducing behavior changes until
then.

This is mostly backwards-compatible, except, of course, for managed
itself. There's a minor difference in _enter_transaction_management:
the top self.transaction_state now contains the new 'managed' state
rather than the previous one. Django doesn't access
self.transaction_state in _enter_transaction_management.
2013-03-11 14:48:53 +01:00
Aymeric Augustin
9cec689e6a Moved a warning in the 1.6 notes back to its expected location. 2013-03-11 12:04:29 +01:00
Aymeric Augustin
ce76fbfc5a Fixed #20019 -- Ensured HttpRequest.resolver_match always exists.
Obviously it isn't set until the URL is resolved.
2013-03-10 23:28:19 +01:00
Ramiro Morales
7fca4416c7 Made (make|compile)messages check for availability of gettext commands.
Refs #19584.
2013-03-10 17:31:11 -03:00