Commit Graph

3962 Commits

Author SHA1 Message Date
Aymeric Augustin f8a634afa2 Fixed tests that relied on MANAGERS not being empty.
Regression in d0561242.
2013-03-11 23:30:02 +01:00
Jacob Kaplan-Moss d056124269 Remove a special case for comment tests from runtests.py. 2013-03-11 15:38:53 -05:00
Aymeric Augustin b746f8a9e3 Adjusted query counts to account for new savepoints. 2013-03-11 21:07:19 +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 e654180ce2 Improved the API of set_autocommit. 2013-03-11 15:10:58 +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 107d9b1d97 Added an option to disable the creation of savepoints in atomic. 2013-03-11 15:05:04 +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 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 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 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 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 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
Claude Paroz 6a91b63842 Fixed #19923 -- Display tracebacks for non-CommandError exceptions
By default, show tracebacks for management command errors when the
exception is not a CommandError.
Thanks Jacob Radford for the report.
2013-03-09 12:38:45 +01:00
Claude Paroz cbfb8ed53b Fixed a regression in forms changed_data
Thanks Loic Bistuer for spotting the regression and the initial
patch. Refs #16612.
2013-03-08 18:19:24 +01:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Aymeric Augustin 477d737e1e Merge pull request #850 from bmispelon/ticket-19916
Fix 19916. Smarter tokenizing of contrib.comment's templatetags arguments
2013-03-07 12:12:29 -08:00
Alex Gaynor bbbd698c7a Added a ManyToManyField(db_constraint=False) option, this allows not creating constraints on the intermediary models. 2013-03-07 11:24:51 -08:00
Baptiste Mispelon 81804ae474 Fix 19916. Smarter tokenizing of contrib.comment's templatetags arguments. 2013-03-07 19:30:38 +01:00
Claude Paroz 4cccb85e29 Fixed #19997 -- Added custom EMPTY_VALUES to form fields
Thanks Loic Bistuer for the report and the patch.
2013-03-07 15:22:03 +01:00
Igor Támara e2ee02c5bd Fixed #19951 -- Admin: Invalid model PK values shouldn't cause 500 status.
Avoid ValueError in admin when passing a string as PK for an inherited
model with an integer PK field.

Thanks ikks for the patch. See also #11191.
2013-03-06 21:38:44 -03:00
Ramiro Morales c31a9793c6 Merge pull request #882 from loic/testfix
Fixed minor warnings in tests.
2013-03-06 16:22:06 -08:00
Preston Holmes 876fc39128 PEP8 cleanup of functional.py 2013-03-06 16:14:46 -08:00
Preston Holmes 0ea5bf88dd Fixed #19543 -- implemented SimpleLazyObject.__repr__
Thanks to Florian Hahn for the patch
2013-03-06 16:13:12 -08:00
Aymeric Augustin b3aa853ec5 Used more precise test assertions. 2013-03-06 15:33:35 +01:00
Loic Bistuer 9ba0e4e4ee Fixed minor warnings in tests. 2013-03-06 01:13:36 +07:00
Juan Pedro Fisanotti d9330d5be2 Fixed #6585 -- Admin relationship widgets: Respect ordering defined by target model's ModelAdmin.
Thanks Gary Wilson for the report and Juan Pedro Fisanotti, Carlos
Matías de la Torre for the fix.
2013-03-04 18:08:53 -03:00
Javier Mansilla 3ea0c7d35a Fixed #19838 -- Admin: Don't leak a 500 HTTP status when trying to delete protected FKs.
Thanks rafadev for the report and Javier Mansilla for the fix.
2013-03-04 13:30:59 -03:00
Ramiro Morales 60dd4eabe7 Removed mentions of modeltests. 2013-03-03 18:44:06 -03:00
matiasb 804366327d Fixed #19915 - Made blocktrans tag honor TEMPLATE_STRING_IF_INVALID.
Thanks Natalia Bidart for the report and Matías Bordese for the fix.
2013-03-03 16:10:11 -03:00
Claude Paroz 384c180e41 Fixed #19917 -- Added microseconds in default TIME_INPUT_FORMATS
Thanks minddust for the report.
2013-03-02 18:11:10 +01:00
Aymeric Augustin e0449316eb Fixed #18130 -- Made the isolation level configurable on PostgreSQL.
Thanks limscoder for the report and niwi for the draft patch.
2013-03-02 15:05:49 +01:00
Claude Paroz c5a25c2771 Add introspection support for BinaryField 2013-03-02 10:29:03 +01:00
Claude Paroz d680a3f447 Added support for serializing BinaryField 2013-03-02 10:29:02 +01:00
Claude Paroz 8ee1eddb7e Add a BinaryField model field
Thanks Michael Jung, Charl Botha and Florian Apolloner for review
and help on the patch.
2013-03-02 10:29:02 +01:00
Simon Charette 0f306cad84 Import `CaptureQueriesContext` from its original module. 2013-03-02 03:45:42 -05:00
Simon Charette fb3d85bd14 Fixed #10399 -- Tested that o2o field updates are not constrained by an inner query. 2013-03-02 03:24:08 -05:00
Simon Charette 952ba5237e Added a context manager to capture queries while testing.
Also made some import cleanups while I was there.

Refs #10399.
2013-03-02 02:41:14 -05:00
Claude Paroz 3318595c0b Fixed #18898 -- Added tests with a fix for ModelMultipleChoiceField 2013-03-01 09:35:18 +01:00
Claude Paroz 892bc91cb0 Fixed #16612 -- Improved has_changed detection for localized field values
Thanks Simon Charette for the review.
2013-03-01 09:35:04 +01:00
Aymeric Augustin cf30469164 Fixed tests broken in 2ee21d9. 2013-02-28 17:08:16 +01:00
Aymeric Augustin 2ee21d9f0d Implemented persistent database connections.
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-28 15:28:13 +01:00
Aymeric Augustin aa089b106b Fixed #5241 -- Kept active transalation in LocaleMiddleware.process_response. 2013-02-28 14:21:48 +01:00