Commit Graph

83 Commits

Author SHA1 Message Date
Raphaël Hertzog 9f4e031bd3 Fixed #25761 -- Added __cause__.__traceback__ to reraised exceptions.
When Django reraises an exception, it sets the __cause__ attribute even
in Python 2, mimicking Python's 3 behavior for "raise Foo from Bar".
However, Python 3 also ensures that all exceptions have a __traceback__
attribute and thus the "traceback2" Python 2 module (backport of Python
3's "traceback" module) relies on the fact that whenever you have a
__cause__ attribute, the recorded exception also has a __traceback__
attribute.

This is breaking testtools which is using traceback2 (see
https://github.com/testing-cabal/testtools/issues/162).

This commit fixes this inconsistency by ensuring that Django sets
the __traceback__ attribute on any exception stored in a __cause__
attribute of a reraised exception.
2015-12-03 16:31:50 -05:00
Tim Graham 4fd264b6f1 Refs #24351 -- Removed support for the old allow_migrate() signature per deprecation timeline. 2015-09-23 19:31:09 -04:00
Caio Ariede ec9004728e Fixed #25175 -- Renamed the postgresql_psycopg2 database backend to postgresql. 2015-08-07 09:33:17 -04:00
Tim Graham 28ee511b7e Fixed db.utils.load_backend() on non-ASCII paths. 2015-07-17 08:21:43 -04:00
Tim Graham bbbb7ce115 Filtered out 'base' from database backend choices error message. 2015-07-15 10:51:26 -04:00
Tim Graham aaacaeb096 Renamed RemovedInDjangoXYWarnings for new roadmap.
Forwardport of ae1d663b79
from stable/1.8.x plus more.
2015-06-24 16:08:20 -04:00
Tim Graham 3872a33132 Fixed #24979 -- Removed usage of inspect.getargspec(). 2015-06-15 13:43:22 -04:00
Tim Graham 47fcbe506c Fixed flake8 warnings on Python 3. 2015-06-15 11:27:09 -04:00
Aymeric Augustin ed83881e64 Fixed #23820 -- Supported per-database time zone.
The primary use case is to interact with a third-party database (not
primarily managed by Django) that doesn't support time zones and where
datetimes are stored in local time when USE_TZ is True.

Configuring a PostgreSQL database with the TIME_ZONE option while USE_TZ
is False used to result in silent data corruption. Now this is an error.
2015-05-17 09:40:28 +02:00
Andrei Kulakov e2bfcab065 Fixed #24394 -- Allowed running tests with empty default dictionary. 2015-03-25 17:56:59 -04:00
Loic Bistuer bed504d70b Fixed #24351, #24346 -- Changed the signature of allow_migrate().
The new signature enables better support for routing RunPython and
RunSQL operations, especially w.r.t. reusable and third-party apps.

This commit also takes advantage of the deprecation cycle for the old
signature to remove the backward incompatibility introduced in #22583;
RunPython and RunSQL won't call allow_migrate() when when the router
has the old signature.

Thanks Aymeric Augustin and Tim Graham for helping shape up the patch.

Refs 22583.
2015-02-20 21:34:09 +07:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham f635d75935 Removed support for old-style test database settings per deprecation timeline. 2015-01-17 09:55:18 -05:00
Tim Graham d79a30ba3f Removed fallback suport for allow_syncdb() in database routers per deprecation timeline. 2015-01-17 07:39:46 -05:00
Loic Bistuer 8f4877c89d Fixed #22583 -- Allowed RunPython and RunSQL to provide hints to the db router.
Thanks Markus Holtermann and Tim Graham for the review.
2015-01-10 00:30:48 +07:00
Claude Paroz 1d24f073e6 Fixed #21255 -- Closed connections after management command ran
Thanks kabakov.as@gmail.com for the report, and Aymeric Augustin,
Simon Charette for the reviews.
2014-12-29 19:02:45 +01:00
Shai Berger 88edce2abb Restored the 'TEST_' prefix in the warning about deprecated test database settings 2014-12-01 02:12:19 +02:00
Anubhav Joshi 9bc2d766a0 Fixed #21755 -- Added ForeignKey support to REQUIRED_FIELDS.
This allows specifying ForeignKeys in REQUIRED_FIELDS when using a
custom User model.

Thanks cjerdonek and bmispelon for suggestion and timgraham for review.
2014-07-03 07:42:52 -04:00
Tim Graham a2cd0e12c9 Silenced deprecation warnings for refs #22811 and fixed build. 2014-06-12 09:28:36 -04:00
Tim Graham 1c58cabad7 Fixed #22811 -- Allowed setting both the old and new TEST database settings.
An ImproperlyConfigured exception will be raised they mismatch.
2014-06-12 08:17:49 -04:00
Anubhav Joshi 42736ac8e8 Fixed #21430 -- Added a RuntimeWarning when unpickling Models and QuerySets from a different Django version.
Thanks FunkyBob for the suggestion, prasoon2211 for the initial patch,
and akaariai, loic, and charettes for helping in shaping the patch.
2014-06-11 10:03:34 -04:00
Aymeric Augustin 06160cb945 Removed deprecated TRANSACTIONS_MANAGED setting. 2014-03-21 21:34:47 +01:00
Shai Berger deff74ea0c Fixed the last fix for database test settings to work with Python3. 2014-03-09 12:27:12 +02:00
Shai Berger 84c137490b Fixed test breakage following test-settings enhancements 2014-03-09 10:23:47 +02:00
Shai Berger 41afae4ce9 Reorganized the database test settings
Change database test settings from "TEST_"-prefixed entries in the
database settings dictionary to setting in a dictionary that is itself
an entry "TEST" in the database settings.

Refs #21775

Thanks Josh Smeaton for review.
2014-03-09 03:57:18 +02:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Marc Tamlyn d238ab2991 Silence deprecation warnings.
Also they should only be raised if allow_syncdb does exist, not just if
allow_migrate does not.

Refs comments on 250841017c
2014-02-09 17:48:15 +00:00
Marc Tamlyn 250841017c Raise (pending) deprecation warning for allow_syncdb. 2014-02-09 11:42:34 +00:00
Berker Peksag 5d263dee30 Fixed #21674 -- Deprecated the import_by_path() function in favor of import_string().
Thanks Aymeric Augustin for the suggestion and review.
2014-02-08 11:12:19 -05:00
Aymeric Augustin 856aaaf2b1 Changed get_migratable_models to use an app config. 2013-12-29 21:25:28 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 4a56a93cc4 Moved the new app cache inside core. 2013-12-17 10:17:46 +01:00
Aymeric Augustin 8662654d6d Removed module-level functions for the app cache.
Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.

They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.

This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
2013-12-17 10:17:44 +01:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Claude Paroz 650b6fd90e Add get_migratable_models util method to ConnectionRouter 2013-10-16 18:02:49 +02:00
Anssi Kääriäinen 9400142132 Fixed #21109 -- made db cursor error wrapping faster 2013-09-17 12:18:55 +03:00
Andrew Godwin de64c4d6e9 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/core/management/commands/flush.py
	django/core/management/commands/syncdb.py
	django/db/models/loading.py
	docs/internals/deprecation.txt
	docs/ref/django-admin.txt
	docs/releases/1.7.txt
2013-08-09 14:17:30 +01:00
Andrew Godwin 12e9804d16 Rename allow_syncdb to allow_migrate 2013-07-30 12:08:59 +01:00
Claude Paroz fdd7a355bf Deprecated django.utils.importlib
This was a shim for pre-Python 2.7 support.
2013-07-29 17:10:22 +02:00
Aymeric Augustin d5589b4cd3 Removed some conditional code only needed under Python 2.6. 2013-07-01 12:02:17 +02:00
Aymeric Augustin acd7b34aaf Advanced deprecation warnings for Django 1.7. 2013-06-29 18:49:37 +02:00
James Aylett 5448555785 Fixed #17601 -- expose underlying db exceptions under py2
Use __cause__ to expose the underlying database exceptions even
under python 2.
2013-06-04 12:46:10 +01:00
Claude Paroz 7e95d7a930 Fixed a regression in router initialization
Regression was introduced in 6a6bb168b. Thanks Bas Peschier for the
report.
2013-05-24 20:48:02 +02:00
Claude Paroz 6a6bb168be Delayed settings.DATABASE_ROUTERS usage by ConnectionRouter
Refs #20474.
2013-05-23 15:19:12 +02:00
Claude Paroz 2d8c132b18 Delayed settings.DATABASES usage by ConnectionHandler
Refs #20474.
2013-05-23 15:19:12 +02:00
Aymeric Augustin 3d595c3bc3 Fixed #20215 -- Disabled persistent connections by default. 2013-05-09 15:42:14 +02: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 cf30469164 Fixed tests broken in 2ee21d9. 2013-02-28 17:08:16 +01:00